Return to Snippet

Revision: 52223
at October 17, 2011 00:51 by aristoworks

Initial Code
function convert($twitter_datetime = '') {

	$mysql_format = date("Y-m-d H:i:s", strtotime($twitter_datetime));

	return $mysql_format;



$date = convert("Sat, 15 Oct 2011 00:29:53 +0000");

// WILL RETURN 2011-10-14 00:29:53

Initial URL

Initial Description
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.

Initial Title
Convert Twitter API Datetime to MySQL Datetime Format

Initial Tags
mysql, php, date, api, convert, twitter

Initial Language