This is the format I have:
Sunday, March 29 4:30 PM
This is the format I want:
2015-05-29 16:30:00
I tried:
Date('Y-m-d H:i:s', strtotime($dateTime));
But it does not work. Any help?
This is the format I have:
Sunday, March 29 4:30 PM
This is the format I want:
2015-05-29 16:30:00
I tried:
Date('Y-m-d H:i:s', strtotime($dateTime));
But it does not work. Any help?
This should work for you:
(Just use DateTime::createFromFormat
)
$date = DateTime::createFromFormat("D, M d h:i A", "Sunday, March 29 4:30 PM");
echo $date->format("Y-m-d H:i:s");
output:
2015-03-29 16:30:00