XML time stamp "Thu, 30 Jun 2011 07:34:33 +0000" t


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

我有"Thu, 30 Jun 2011 07:34:33 +0000"作为Twitter RSS提要的时间戳。我的服务器在东部时间。我需要把它转换成unix时间。我不知道从哪里开始。我猜推特应该是太平洋时间,除非是24小时。

我还有另一个使用相同格式的rss提要。什么好主意吗?

我甚至不知道我该在谷歌上输入什么来找到答案。

使用strtotime()函数:

 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!

为了将来的参考,下次在Google上试试"php twitter date unix":)

use strtotime();

。: strtotime("Thu, 30 Jun 2011 07:34:33 +0000")