How to get a list of strings in tzdb used as a timezone initializer?

SO I am new to NodaTime and trying to use it to store timezone information using a DateTimeZone object.

I came across the example below in a user manual, etc. that give me a nice DateTimeZone from tzdb, which is great.

var london = DateTimeZoneProviders.Tzdb["Europe/London"]; 

My question is: how do I get a list of timezone lines ("Europe / London") that are used in tzdb. I looked around, nowhere to find. Is there a standard list I can refer to? How it works? ex. - What line should I pass for EST?

Thanks!

+6
source share
1 answer

To program time zone identifiers, use the Ids property in the IDateTimeZoneProvider . For example, to find all zones:

 var provider = DateTimeZoneProviders.Tzdb; foreach (var id in provider.Ids) { var zone = provider[id]; // Use the zone } 

In Eastern time, you probably want America / New_York.

In general, these identifiers are IANA identifiers — and they are used on most non-Windows systems.

+13
source

All Articles