Such city-based time zones (or whatever you call this) as Asia/Shanghai
, America/Los_Angeles
are widely used in PHP and Java, for example,
java.util.TimeZone.TimeZone timeZoneNewYork = java.util.TimeZone.TimeZone.getTimeZone("America/New_York");
As far as I know, .Net uses a different key to get the corresponding time zone, for America/New_York
it's Eastern Standard Time
TimeZoneInfo timeZoneInfoNewYork = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
If I have a city-based time zone string, e.g. "America/New_York"
, how can I convert it to the right time zone in .Net, TimeZoneInfo{Eastern Standard Time}