Convert a time string eg "Wed, 24 Nov 2010 13:10:00 EST" to DataTime in PHP
I am parsing a xml, and I get the created time as: Wed, 24 Nov 2010 13:10:00 EST
My requirement is to convert this time开发者_如何学JAVA into the specified time format using DateTime function before inserting it in the database.
Can anyone help me with this.
Thanks you Zeeshan
set EST timezone
date_default_timezone_set('America/New_York');
convert to epoch
$epoch = strtotime('Wed, 24 Nov 2010 13:10:00 EST');
get date/time
echo date('Y-m-d H:i:s', $epoch);
精彩评论