1

I have a date string value that changes everytime , sometimes it is for instance:

'14-30-06'
'30/06/2014'
'06/30/2014'
'30-06-14'
...

how can I do in PHP to convert the date I get whatever format it has to this format : m/d/Y ?

here is the code that I'm using and that did not work, I get 01/01/1970

$date = "14-30-06";
$dtFormat = "m/d/Y";
echo date($dtFormat, strtotime($date));
pes502
  • 1,597
  • 3
  • 17
  • 32
user3593154
  • 115
  • 2
  • 9

0 Answers0