none
Time zones RRS feed

  • Question

  • Can anyone explain why .Net doesn't use a comprehensive enum for representing all world time zones? It seems time zones are specified as strings (e.g 'Mountain Standard Time') when we want convert zones (see TimeZoneInfo class). Every time zone seems to have a code that could have been used in an enum but I dont see this. See this article: https://en.wikipedia.org/wiki/List_of_time_zone_abbreviations
    Tuesday, January 17, 2017 1:09 PM

All replies

  • You almost certainly do not want to specify code for a specific time zone at compile time, with the possible exception of GMT.

    Time zones change with the laws of the nations that use them.  Burning them into your code is not a way to future-proof your application.

    • Proposed as answer by Kristin Xie Wednesday, January 18, 2017 3:11 AM
    Tuesday, January 17, 2017 3:32 PM