Convert "Day Date Of Month YYYY" To YYYY-MM-DD In Php -


how convert "friday 20th of march 2015" "2015-03-20" in php ?

options tried (failed):

$time = strtotime(stripslashes("friday 20th of march 2015")); echo date("y-m-d",$time);   $time = strtotime("friday 20th of march 2015"); echo date("y-m-d",$time); 

option 2 (failed):

$old_date = date('friday 20th of march 2015');            $old_date_timestamp = strtotime($old_date); $new_date = date('y-m-d', $old_date_timestamp);    echo $new_date; 

option 3 (failed):

$date = datetime::createfromformat('l d of f y', 'friday 20th of march 2015'); $new_date_format = $date->format('y-m-d'); echo $new_date_format; 

duplicate entries didn't work out: how convert "day, dd month yyyy" "yyyy-mm-dd" in php

convert 1 date format in php

this code works:

$date = datetime::createfromformat('l ds \o\f f y', 'friday 20th of march 2015');         $new_date_format = $date->format('y-m-d');         echo $new_date_format; 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -