"how to store timezoneinfo objects in a database?" Code Answer

4

yes, id is a non-localized identifier, so that's an appropriate thing to store.

you should be aware of one possible problem though: identifiers can change over time. i don't know whether it's an issue in windows time zone identifiers, but it certainly occurs in the olson (zoneinfo) database. for example, i was recently looking at an issue caused by "pacific/ponape" changing to "pacific/pohnpei".

i suspect that as microsoft has tighter control over the ids, they're more likely to remain the same - but even so, countries can change their names, split into different countries (potentially creating new time zones) etc.

i'm not suggesting any fixes for this problem - just highlighting it as a potential issue. storing the id is probably the best approach available, but be aware of the potential risks...

By Bill Kotsias on August 25 2022

Answers related to “how to store timezoneinfo objects in a database?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.