I have a variable in php:
$d = "19:02:13 Nov 07, 2010 PST";
What is the quickest way to convert the format so I get (mysql DATETIME):
$d = "2010-11-07 19:02:13";
I have a variable in php:
$d = "19:02:13 Nov 07, 2010 PST";
What is the quickest way to convert the format so I get (mysql DATETIME):
$d = "2010-11-07 19:02:13";
try this
date_default_timezone_set("America/Los_Angeles");
echo date("Y-m-d H:i:s", strtotime("19:02:13 Nov 07, 2010 PST"));
As easy (though not epically efficient) way would be to use strtotime as follows:
date('Y-m-d H:i:s', strtotime('19:02:13 Nov 07, 2010 PST'))
However, make sure you've set the correct local timezone via date_default_timezone_set or this will not work correctly.