0

My date is save in db as 08/07/1990. I want to display it in web as 08 july 1990

When I use this format date('d-F-Y',strtotime($date));

It display as 07 Aug 1990 instead of 08 july 1990.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

-2

Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed. Check more here: php.net/manual/en/function.strtotime.php

$dateInput = '08/07/1990';
$date      = str_replace('/', '-', $dateInput);
echo date('d-F-Y', strtotime($date));

//08-July-1990

Upvote if found your answer. *but one thing is clear that if you saved year as 1990 then it can't possible to make it 2019.

Prahsant Sharma
  • 371
  • 4
  • 13