I have some dates that are returned as the following string:
Fri, 13 Aug 2010 01:48:47 -0400 (EDT)
I'd like to parse this and turn it into a datetime stamp, so like this:
2010-08-13 01:48:47
Any help would be awesome... thank you!
It looks like you do NOT want the timezone to be converted.
You can do it using date()
and strtotime()
functions like this:
$date = "Fri, 13 Aug 2010 01:48:47 -0400 (EDT)";
$date = explode('-',$date);
echo date("Y-m-d H:i:s", strtotime($date[0])); //does not use TimeZone info
This outputs:
2010-08-13 01:48:47
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.