Java – why does the time zone mode “oooo” not display the full GMT 00:00 offset format?
•
Java
Is this an error or a function?
Datetimeformatter Javadoc clearly states that when I use oooo mode in the formatter, I should use the full form of localized time zone (emphasize my):
But if the time is 0 GMT:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEE yyyy.MM.dd HH:mm:ss.SSS OOOO");
String timestamp = OffsetDateTime.ofInstant(Instant.Now(),ZoneOffset.UTC).format(formatter);
System.out.println(timestamp);
This is the output:
Mon 2019.02.25 22:30:00.586 GMT
expect:
Mon 2019.02.25 22:30:00.586 GMT+00:00
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码