views:

17

answers:

1

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!

+1  A: 

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

shamittomar
Awesome, thank you!
Dave