[英]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
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如需进一步参考,您可以查看
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.