开发者

XML time stamp "Thu, 30 Jun 2011 07:34:33 +0000" to Unixtime?

开发者 https://www.devze.com 2023-04-10 15:49 出处:网络
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

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")

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号