2011-10-02 159 views
1

我將「Thu,2011年6月30日07:34:33 +0000」作爲Twitter RSS源的時間戳記。我的服務器在東部時間。我需要一些如何將其轉換爲unixtime。我不知道從哪裏開始。我想Twitter會在太平洋時間,除非它像24小時。XML時間戳「Thu,30 Jun 2011 07:34:33 +0000」to Unixtime?

我也有另一個使用相同格式的RSS源。有任何想法嗎?甚至不知道我會輸入什麼來找到答案。

回答

2

使用strtotime();

例如爲:strtotime("Thu, 30 Jun 2011 07:34:33 +0000")

+1

這工作!謝謝!很高興這很簡單。我在想這樣做會是很多數學和混亂的代碼。 – Keverw

+0

我很高興聽到這個消息 – elibyy

3

使用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! 

而且以供將來參考,嘗試 「PHP嘰嘰喳喳日期UNIX」 在谷歌下一次:)

相關問題