XML time stamp "Thu, 30 Jun 2011 07:34:33 +0000" to Unixtime?
I have "Thu, 30 Jun 2011 07:34:33 +0000" as a time stamp from Twitter RSS fee开发者_Python百科d. My server is in Eastern time. I need to some how convert this over to unixtime. I have no clue where to start. I guess Twitter would be in pacific time unless its like 24 hours.
I also have another rss feed that uses the same format. Any ideas? Not even sure what i would type in to Google to find a answer for this.
Use the strtotime()
function:
date_default_timezone_set($user_timezone); // Set the user's timezone if you'd like
$time = strtotime("Thu, 30 Jun 2011 07:34:33 +0000") // Convert the time
echo date("l M j \- g:ia", $time); // Print it in any format you want!
And for future reference, try "php twitter date unix" on Google for next time :)
use strtotime()
;
e.g.: strtotime("Thu, 30 Jun 2011 07:34:33 +0000")
精彩评论