Convert Twitter API Datetime to MySQL Datetime Format
This is a very rudimentary function used to convert a Datetime delivered by the Twitter API to a format you can store in MySQL's datetime field.
Copy this code and paste it in your HTML
function convert($twitter_datetime = '') {
$mysql_format = date("Y-m-d H:i:s", strtotime($twitter_datetime));
return $mysql_format;
}
// SIMPLE USAGE
$date = convert("Sat, 15 Oct 2011 00:29:53 +0000");
// WILL RETURN 2011-10-14 00:29:53
URL: http://www.aristoworks.com
Report this snippet
Comments
Subscribe to comments