Reputation: 1003
Twitter's API kicks out a date in this format:
Thu, 18 Oct 2012 09:37:01 +0000
Is it possible to convert this into a datetime format using PHP, for my database? E.g.
2012-10-18 09:37:01
Upvotes: 2
Views: 6006
Reputation: 1862
Use the Datetime Object from format
$date = DateTime::createFromFormat('D, j M Y H:i:s +0000', 'Thu, 18 Oct 2012 09:37:01 +0000');
echo $date->format('Y-m-d H:i:s');
Upvotes: 1
Reputation: 8986
date( 'Y-m-d H:i:s', strtotime("Thu, 18 Oct 2012 09:37:01 +0000") );
Upvotes: 6