有人可以向我解释为什么当我尝试获取与我自己不同的区域的 DateTime 的毫秒数时,它会给我本地机器时区的毫秒数吗?我希望获得 UTC 的毫秒数,但我的应用程序本地设置设置为 EST(即使我实际上在爱尔兰;))
这是代码:
DateTimeFormatter format = DateTimeFormat.mediumDateTime();
DateTime local = new DateTime();
DateTime utc = new DateTime(System.currentTimeMillis(), DateTimeZone.UTC);
System.out.println("utc zone = " +utc.getZone());
System.out.println("UTC time: " + utc);
long current = utc.getMillis();
System.out.println("current: " + format.print(current));
System.out.println("local: " + format.print(local.getMillis()));
这是它打印的内容:
utc zone = UTC
UTC time: 2013-08-16T13:36:32.444Z
current: Aug 16, 2013 9:36:32 AM
local: Aug 16, 2013 9:36:32 AM
目前,我认为它应该与 UTC 时间具有相同的日期时间?