2

C# supports different timezone id's across the globe. Please find list of time zones that are being supported by C# in below link:

https://msdn.microsoft.com/en-us/library/gg154758.aspx

The timezone id's are used in C# library functions to convert times across the timezones.

[e.g. TimeZoneInfo.ConvertTimeBySystemTimeZoneId("Hawaiian Standard Time")]

Similarly I want support for AMERICA/MIQUELON, which is not present in the msdn list provided in above link.

Can somebody please provide workaround for this specific timezone?

JNYRanger
  • 6,829
  • 12
  • 53
  • 81
user861341
  • 39
  • 1
  • 4
  • You can **easily** enumerate all timezones known to C# / .NET by looking at the [code presented in this other SO question](http://stackoverflow.com/questions/7908343/list-of-timezone-ids-for-use-with-findtimezonebyid-in-c) - if your timezone strings show up - they're supported by .NET ... – marc_s Jun 16 '15 at 10:26
  • 1
    It is not part of Canada, it covers two small islands that are part of France, just 6000 people live there. Web sites disagree but the majority favor UTC-3:00 with daylight savings. Too obscure to be covered by the built-in Windows timezones, non-zero odds that they follow Newfoundland. Best thing to do is ask your customer what they do about it. – Hans Passant Jun 16 '15 at 12:49
  • Why don't you just use another timezone that uses the same UTC offset? – JNYRanger Jun 18 '15 at 17:09

1 Answers1

3

Time zone identifiers like "America/Miquelon" and the others you listed (before editing your question) are from the IANA time zone database. You can read more in the timezone tag wiki and on Wikipedia.

Note that they are usually presented in mixed case form, rather than in all capital letters.

The easiest and best way to work with these in .NET is via the Noda Time library.

For example:

DateTimeZone tz = DateTimeZoneProviders.Tzdb["America/Miquelon"];
Instant now = SystemClock.Instance.Now;
ZonedDateTime converted = now.InZone(tz);
Community
  • 1
  • 1
Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575