0
A
回答
0
<?php
//current time zone to UTC
$date = new DateTime($datetime, new DateTimeZone(date_default_timezone_get()));
//set the time zone as UTC
$date->setTimezone(new DateTimeZone('UTC'));
//convert local time to UTC time
$date=$date->format("Y-M-D");
echo $date;
//--------------------------------------------------------------------
//UTC to some other time zone format
$date = new DateTime($datetime, new DateTimeZone("UTC"));
//set the time zone as UTC
$date->setTimezone(new DateTimeZone(date_default_timezone_get()));
//convert local time to UTC time
$date=$date->format("Y-M-D");
echo $date;
相关问题
- 1. UTC日期转换为当地时区
- 2. 转换UTC中的Epoch到当前时区日期
- 3. 如何比较UTC日期和Android中的当前UTC时间?
- 4. 当前时间= UTC +/-(UTC +/-当前时间)
- 5. JS仅限UTC时区的日期
- 6. 转换UTC日期,以其它时区
- 7. UTC日期到当前TimeZone字符串和结果StringDate到当前TimeZone日期
- 8. 违约日期的时区为UTC对Jodatime的日期时间
- 9. 如何将日期更新为UTC的当前日期-8
- 10. UTC日期到当地日期在swift
- 11. UTC转换为当地日期时间
- 12. MomentJS - 从UTC日期时间转换到不同的时区
- 13. 将当地日期时间转换为UTC日期时间
- 14. 转换UTC日期时间当地日期时间
- 15. 将UTC日期时间转换为当地日期时间
- 16. 在Apache Camel格式化UTC的当前日期和时间
- 17. 用特殊格式打印当前UTC日期时间
- 18. 转换毫秒与UTC时区UTC日期对象
- 19. 当前日期的UTC秒应该给出UTC日期,当它再次转换为使用这些UTC秒的日期时。
- 20. 角度4:日期管道,UTC到当地时间的时间:如何判断当前时区的角度?
- 21. 从UTC-5时区日期和时间获取iPhone设备的时区日期和时间iPhone应用程序?
- 22. 从当地时区转换为日期?
- 23. 如何获取当地时区的当前日期和时间?
- 24. 需要从当前日期()删除时区()xquery
- 25. Objective-C NSDate - 如何从不同时区获取当前日期
- 26. 将日期从不同的时区转换为UTC
- 27. 如何从Excel VBA宏获取UTC中的当前日期时间
- 28. 如何从当前日期时间扣除时间/日期
- 29. 日期。减去从列当前日期
- 30. 如何从UTC日期格式获取正确的时区(服务器时区)
你试过吗? http://stackoverflow.com/questions/8655515/get-utc-time-in-php –