Serializing `FixedOffsetTimeZone` doesn't produce timezone database entry
See original GitHub issueWhen serializing the constant TimeZone.UTC, which is a FixedOffsetTimeZone, I was seeing the value "Z". Comparing this against the tzdb, I don’t believe this to be the right value. I believe the correctly encoded value should be one of:
Etc/ZuluEtc/UTCZuluUTC
Is it possible the Z is the serialized form of the offset portion of an ISO 8601 String? Is that to be expected? I would expect the serialization of a TimeZone to yield the tzdb name.
I am unsure if other instances of FixedOffsetTimeZone experience the same problem. I’m happy to help dig in if more info is needed.
Issue Analytics
- State:
- Created a year ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
Time zone database file format - Noda Time
Time zone database file format. This document describes the Noda Time-specific binary file format that is produced by Noda Time's NodaTime.
Read more >How to add timezone offset to JSON.NET serialization?
Strange thing is if I create brand new DateTime object and assign to DateTime.Now without binding, JSON.NET will append timezone offset to it....
Read more >Serialization/deserialization does not round trip #45 - GitHub
I'd be happy to take a PR that changes the serialization of timezones to the full name. Tz deserialization may still fail if...
Read more >timezone - Amazon Redshift - AWS Documentation
Because time zone abbreviations, such as PST or PDT, are defined as a fixed offset from UTC and don't include daylight savings time...
Read more >Time Zone Database Parser - Howard Hinnant
The effect of this pairing is to create a time_point with the exact same UTC time point, but associated with a different time_zone...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I see the difference between them as the difference between numbers (
5,-10) and functions that return numbers ({ _ -> 5 },{ _ -> 10 }). Another analogy is the difference between a clock reading (the position of the hour and minute hands) and a clock that is stuck. Is a clock that is stuck forever literally just the time that it shows?A time zone is a function that maps the actual time to the
UtcOffsetthat is used in that location at that moment, and a fixed-offset time zone is, when seen like this, a constant function.FixedOffsetTimeZone, as you saw, also stores the name of the timezone. For example, GMT and UTC are both timezones that are fixed-offset and always have theUtcOffsetvalue of zero, but they even have different Wikipedia pages: https://en.wikipedia.org/wiki/Universal_Time https://en.wikipedia.org/wiki/Greenwich_Mean_Time Time zones are used not only for computation but also for communication. If someone says something is in the GMT timezone, maybe the do want to highlight that it’s not the UTC timezone. Who knows.java.timehas the classZoneOffsetwhich is an inheritor ofZoneIdand combines the functionality of expressing an offset from UTC and using it as a time zone. We decided to split these aspects into separate classes. It’s true thatFixedOffsetTimeZoneandUtcOffsethave the same representation when serialized to string, but it doesn’t mean that their functionality is duplicated.