獲取未來時間戳
回答
是,獲得UNIX時間戳,並添加25200到它。如果你想格式化時間戳,你可以使用date()。
$future = time() + (60 * 60 * 24 * 7);
date("o", future);
而且從PHP文檔的時間()
date('Y-m-d', strtotime('+1 week'))
缺少一個乘數Oo – 2010-07-21 23:08:55
你似乎也在用錯誤的語言思考......「'int future'」:) – deceze 2010-07-21 23:12:07
哈哈,真正。多謝你們。 – funwhilelost 2010-07-21 23:35:14
肯定。
獲取當前時間戳。增加7天的時間。
注:時間戳「提前7日」(在7 *86400秒而言)當前時間戳可能不表示相同或當天(耶夏令時的同一時間一週中某一天的! )或甚至相同的秒(罕見,閏閏!)。
只需添加七天麼,
$future = time() + 60*60*24*7;
// seconds ---^^^^
// minutes ---^^^
// hours ---^^
// days ---^
見time()
....哦,因爲有你想要做......我猜你以前沒有閱讀說明書什麼的例子。
time() + (60 * 60 * 24 * 7); // "good enough"
strtotime('+7 days'); // daylight savings save
$now = time() + (7 * 24 * 60 * 60);
獲取當前使用UNIX時間的時間戳(),然後乘以60秒後,60分鐘,24小時,7天。
在最近版本的PHP這樣做是使用DateTime對象(在我看來)的正確方法。
$date = new DateTime('now'); // can be anyting else too
$date->modify('+1 week');
// PHP 5.3
$future = $date->getTimeStamp();
// PHP 5.2
$future = $date->format('U');
我認爲這有點冗長,而不是隻做'strtotime('+ 7天');'正如deceze和infamouse所建議的那樣...... – Cam 2010-07-21 23:21:32
- 1. Javascript:未來時間爲UNIX時間戳
- 2. Cumulocity API獲取時間戳
- 3. 從時間戳獲取本地時間
- 4. HttpErr日誌有未來的時間戳
- 5. 獲取未來的時間作爲NSDate
- 6. 從服務器獲取的時間戳本地時間戳
- 7. 如何從postgres獲取時間戳作爲時間戳?
- 8. 獲取時間戳的時區
- 9. C#獲取帶時區的時間戳
- 10. 獲取即將到來的生日mysql時間戳
- 11. 獲取自facebook上的時間戳以來的更新數
- 12. 使用JavaScript獲取唯一時間戳
- 13. 獲取從時間戳偏秒差
- 14. 如何從numpy.datetime64獲取unix時間戳
- 15. 從圖像獲取「時間戳」
- 16. 如何從網頁獲取時間戳
- 17. 從時間戳獲取日期
- 18. Mysql select - 獲取時間戳的日期
- 19. 獲取當前ISO8601日期/時間戳
- 20. 在php中獲取時間戳
- 21. 獲取java類的編譯時間戳
- 22. UNIX文件獲取由時間戳
- 23. Spark sql(1.4):獲取當前時間戳
- 24. 獲取UTC格式的GWT時間戳
- 25. 插入/更新後獲取時間戳
- 26. 獲取時間戳錯誤的firebase android
- 27. 使用MySQL獲取時間戳
- 28. 如何從Oracle獲取EST時間戳?
- 29. 在Lua中獲取UTC UNIX時間戳
- 30. 從網頁獲取時間戳?
http://us.php.net/manual/en/function.strtotime.php – 2010-07-21 23:11:08
你有沒有給自己任何努力? – deceze 2010-07-21 23:16:08
不能確定谷歌是什麼... ..對不起,浪費數據庫空間 – 2010-07-21 23:20:37