0
A
回答
2
該格式可能不是strtotime()
可以解釋的格式。嘗試使用DateTime::createFromFormat()
代替:
$dt = DateTime::createFromFormat('g:i:sa d/j/Y', '2:28:15am 28/11/2013');
echo $dt->format('Y-m-d H:i:s');
我必須猜測您的日期的確切格式。但是,您可以使用適當的格式化選項listed here輕鬆進行編輯。
+0
謝謝,我可以使用$ dt-> format('U')來獲得unix時間戳。 – BoomBrush
0
沒有您的時間格式問題的strtotime適用於以下格式可以肯定的:
$date->format('Y-m-d G:i:s');
strtotime($date);
相關問題
- 1. strtotime不工作在PHP的HH:MM:SS格式
- 2. PHP日期的strtotime不工作
- 3. php strtotime和工作多年?
- 4. PHP-strtotime()如何工作?
- 5. php strtotime星期四不工作
- 6. php strtotime()值不按預期工作
- 7. 爲什麼strtotime不工作php
- 8. strtotime PHP多個值不一起工作
- 9. php strtotime不起作用
- 10. strtotime(「 - 5小時」)不工作?
- 11. strtotime長時間不工作
- 12. PHP strtotime需要調整
- 13. 的strtotime功能不能正常工作
- 14. 委派的命令不想要工作
- 15. 從PHP到MYSQL的比較日期,strtotime不工作
- 16. PHP IF語句並不像我想要的那樣工作
- 17. strtotime工作不正確-60天
- 18. 查詢不想要工作得很好^^
- 19. SVG .fill僞不想要工作
- 20. 懸停功能不想要工作
- 21. 不要工作在PHP
- 22. 與變量桑達工作不正是我想要的工作
- 23. Strtotime按預期工作
- 24. strtotime無法正常工作
- 25. PHP的strtotime ERROR
- 26. PHP代碼不工作我想如何
- 27. php郵件功能不想工作
- 28. PHP APC不想要存儲
- 29. strtotime在php中使用m-d-Y格式不能在php中工作?
- 30. MPMoviePlayerController不想工作
的strtotime是好的,但它不是無所不知,不能處理多種格式,包括這一個。它可以**處理的內容記錄在這裏:http://php.net/manual/en/datetime.formats.php –