简体   繁体   English

这个日期是祖鲁 (UTC) 时区吗?

[英]Is this date in Zulu (UTC) timezone?

I have a date string as below.我有一个如下的日期字符串。

I think this implies it is in UTC timezone.我认为这意味着它在 UTC 时区。

Is that correct?那是对的吗?

2016-10-30T15:27:02.000Z

Yes.是的。 According to joda , the first millisecond in UTC can be represented in this format: 1970-01-01T00:00:00Z根据joda ,UTC 的第一毫秒可以用这种格式表示: 1970-01-01T00:00:00Z

You correctly guessed it, thats UTC Date and Time.你猜对了,那就是 UTC 日期和时间。

ISO 8601 ISO 8601

Which is October 30th, 2016, at 3:27 pm (+2 seconds) in Greenwich Mean Time.这是格林威治标准时间 2016 年 10 月 30 日下午 3:27(+2 秒)。

For further reference you can check如需进一步参考,您可以查看

ISO 8601 ISO 8601

StackExchange 堆栈交换

Yes, you can verify it by parsing a java.time.ZonedDateTime from the String and print the offset information of it:是的,您可以通过从String中解析java.time.ZonedDateTime并打印它的偏移信息来验证它:

public static void main(String[] args) {
    String utcDateTime = "2016-10-30T15:27:02.000Z";
    ZonedDateTime zdt = ZonedDateTime.parse(utcDateTime);
    System.out.println(zdt.format(DateTimeFormatter
                        .ofPattern("uuuu-MM-dd HH:mm:ss zzz '==>' xxx '=' O")));
}

This outputs这输出

2016-10-30 15:27:02 Z ==> +00:00 = GMT

Note: This output pattern contains redundant information for verification, see the pattern letters in the JavaDocs of java.time.format.DateTimeFormatter注意:此 output 模式包含冗余信息以供验证,请参阅java.time.format.DateTimeFormatter的 JavaDocs 中的模式字母

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM