On Wikipedia time zone offsets are explained as the difference in hours and minutes from standard UTC time. However, DateTimeFormatter supports zone-offset pattern XXXXX
, which "outputs the hour and minute and optional second, with a colon, such as '+01:30:15'."
Are offsets like +01:30:15
ISO valid? If not, based on which standard does Java define such offsets?
The OffsetTime class, in effect, combines the LocalTime class with the ZoneOffset class. It is used to represent time (hour, minute, second, nanosecond) with an offset from Greenwich/UTC time (+/-hours:minutes, such as +06:00 or -08:00).
What is a "zone offset"? A zone offset is the difference in hours and minutes between a particular time zone and UTC. In ISO 8601, the particular zone offset can be indicated in a date or time value. The zone offset can be Z for UTC or it can be a value "+" or "-" from UTC.
Be aware that java. util. Date objects do not contain any timezone information by themselves - you cannot set the timezone on a Date object. The only thing that a Date object contains is a number of milliseconds since the "epoch" - 1 January 1970, 00:00:00 UTC.
Breaking Down the Difference An offset is the number of hours or minutes a certain time zone is ahead of or behind GMT**. A time zone's offset can change throughout the year because of Daylight Saving Time. Sometimes laws change a time zone's offset or daylight savings pattern.
It's not supported by ISO-8601, but it is a valid offset as recorded in the IANA time zone database.
Sub-minute offsets are common in the data for the late 19th and early 20th century, before time zones were properly standardized. For example, Europe/Paris had an offset of +00:09:21 until 1911 (according to the IANA database).
The latest occurrence I can find for this is Africa/Monrovia which had a sub-minute offset until 1972!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With