简体   繁体   English

时区信息 object

[英]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? 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?如果是这样的话,我可以获得时区的单一方法 - 首先我应该通过调用 GetSystemTimeZones() 来获取所有 TimeZone 的 ID,然后找到我想要的时区?

Thanks,谢谢,

Timezones change - as indeed do the rules for each (DST etc).时区发生变化- 每个(DST 等)的规则确实如此。

Enums do not.枚举没有。

For the same reason, culture-info has a string identifier, not an enum.出于同样的原因,culture-info 有一个字符串标识符,而不是枚举。 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).我实际上希望你可以对时区做同样的事情(定义你自己的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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