php - DateTime::createFromFormat issue -


i dont know why getting error or how fix it.

call member function format() on non-object createfromformat 

code:

$date = "30 sep 2009"; $data['startdate'] = datetime::createfromformat('d m y', $date)->format('y-m-d'); 

i want convert standard mysql date format.

the error due fact "m" code 2 digit month--not textual representation, "m".

have you, chance, tried passing string datetime constructor? format 1 of accepted ones per http://www.php.net/manual/en/datetime.formats.date.php .

$date = new datetime("30 sep 2009"); $data['startdate'] = $date->format('y-m-d'); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -