0
A
回答
1
您应该检查MongoDate:
//build a MongoDate object from a string format
$mongoDate = new MongoDate(strtotime("2010-01-15 00:00:00"));
一旦你有一个MongoDate
对象(这可能是你的情况下),你可以将其转换为DateTime
对象是这样的:
//get a DateTime object
$phpDate = $mongoDate->toDateTime();
最后将其转换为您想要的格式:
$phpDate->format('M-d-Y');
0
$ date ='2011-09-02T18:00:00';
$ time = strtotime($ date);
$ fixed = date('l,F jS Y \ a \ t g:ia',$ time);
相关问题
- 1. 将日期时间转换为ISO 8601
- 2. 将日期转换为MongoDB ISO日期
- 3. 如何将ISO日期转换为Hive中的UTC日期
- 4. 将日期字符串转换为带日期的ISO日期
- 5. 将javascript日期时间转换为php日期时间
- 6. 如何将IronPython日期时间转换为.NET日期时间?
- 7. 如何将UTC日期/时间转换为EST日期/时间
- 8. 我如何将日期时间转换为C#中的日期
- 9. 如何将日期时间转换为oracle的日期时间格式在php
- 10. 将日期时间转换为日期为零php
- 11. PHP将日期转换为时间戳
- 12. PHP - 将日期转换为简单的日期时间?
- 13. 如何将我的日期转换为UTC日期时间
- 14. 如何在ISO中将ISO 8601日期转换为UNIX时间戳?
- 15. PHP - 将日期转换为UTC日期
- 16. PHP将日期转换为渐进日期时间
- 17. 如何将日期时间转换为日期
- 18. 如何使用Netezza将日期时间转换为日期
- 19. 如何将日期时间转换为日期?
- 20. 如何将TSQL日期时间转换为Julian INT日期
- 21. 如何将日期和时间转换为日期
- 22. 转换ISO 8601日期字符串到.NET日期时间
- 23. 转换PHP日期时间
- 24. 日期时间转换PHP
- 25. MongoExport将ISO日期转换为数值
- 26. Qt将ISO日期转换为QDate
- 27. 将日期时间转换为时间
- 28. 将C#日期时间转换为XML日期时间类型
- 29. 将日期和时间转换为日期+时间戳
- 30. 将时间和日期转换为mysql日期时间
你的日期在哪里存储?在一个PHP变量? – Moppo
你是如何查询数据库的。有教义吗?如果是MongoDate类型,请尝试''$ date-> toDateTime();'' – Xatoo
在mongodb中。我需要以M-d-Y的形式输出。 – user996581