简体   繁体   中英

TimeZoneInfo object

I want to use TimeZoneInfo, as I understood the TimeZoneInfo object take its information from the registry - but I dont understand why this object doesnot expose an enum or something else that contains all the TimeZone IDs - is it because the IDs are diffrent between duffrent windows? and if so the single way that I can get something time zone - first I should get all TimeZone's IDs by invoke GetSystemTimeZones() and then find the time zone that I want?

Thanks,

Timezones change - as indeed do the rules for each (DST etc).

Enums do not.

For the same reason, culture-info has a string identifier, not an enum. This also allows you to define your own cultures at runtime, and pick up changes as the OS gets updates from external sources. I actually hope you can do the same with timezones (define your own).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM