Q
PHP日期函数
5
A
回答
4
DD/MM/YYYY是不是一个有效date format(手动概括它必须遵循supported date and time formats之一。)所以,相反,它应该是MM/DD/YYYY:
echo strtotime("05/31/2011");
或者,我想为其他人发布,欧洲(ISO8601不缩)版本使用连字符:
echo strtotime("31-05-2011");
1
http://php.net/manual/en/function.strtotime.php
使用破折号,而不是正斜杠。
echo strtotime("31-05-2011"); // outputs 1306821600
+0
感谢您的回复.. :-) – 2011-06-14 15:31:09
1
对于欧洲格式的日期(DD-MM-YYYY)使用破折号没有斜杠:
echo strtotime('31-05-2011');
1
echo strtotime("2011-05-31");
1
有关使用PHP的DateTime功能如何?
DateTime::createFromFormat('d/m/Y', '31/05/2011');
相关问题
- 1. php日期函数
- 2. 日期函数PHP
- 3. PHP日期函数
- 4. PHP中的日期函数
- 5. MySQL和PHP日期函数
- 6. PHP日期函数错误
- 7. PHP日期时间函数
- 8. PHP日期比较函数
- 9. 日期时间函数PHP
- 10. PHP日期/时间函数
- 11. 日期函数格式php
- 12. PHP,除了日期函数,有什么函数可以解码日期吗?
- 13. php日期函数意外的结果
- 14. DateTime对象或日期函数php
- 15. 阿拉伯月份日期函数PHP
- 16. PHP函数返回错误日期
- 17. Rails函数或方法像PHP日期()
- 18. 如何使用PHP日期函数
- 19. PHP日期函数七天以前
- 20. PHP中的日期函数问题
- 21. PHP日期函数没有出现
- 22. php时间和日期函数
- 23. 制作使用PHP日期函数
- 24. PHP的日期时间函数
- 25. PHP日期函数返回错误年
- 26. 小问题PHP日期/ strtotime函数
- 27. DateTime类与原生PHP日期函数
- 28. 将CSS应用到PHP日期函数
- 29. 传递两个日期到PHP函数
- 30. 日期函数的PHP问题
的[的strtotime()抛出假上格式化的日期]可能重复(http://stackoverflow.com/questions/5736205/strtotime-throws-false-on-a-formatted-date) – Gordon 2011-06-14 15:20:26
问题你没有读过[用于'strtotime'的PHP手册中的第三个注释](http://php.net/manual/en/function.strtotime.php#refsect1-function.strtotime-notes),解释了什么是 – Gordon 2011-06-14 15:21:54
@Gordon。谢谢你的回答。非常感谢。我已将日期格式更改为“ - ”。 – 2011-06-14 15:29:53