I have a date value in the format of Day MM dd, yyyy
(e.g. Wed Aug 17, 2016
) in PHP and I want to convert it to the format yyyy-mm-dd
(2016-08-dd
).
I have tried following:
$journeyDate = 'Wed Aug 17, 2016';
$time =strtotime(stripslashes($journeyDate));
echo date("Y-m-d", strtotime($time));
But the above code converts the date to desired format but returns date as 1970-01-01
which is wrong. What can I do to fix this problem?