1

The short time zone string I'm getting it as input. I'm trying to avoid to hardcode myself a huge mapping.

4
  • ~Can you give an example of the type of "short" value you're expecting?~ Sorry, I just saw that's in the title. Feb 19, 2019 at 12:28
  • Check this thread stackoverflow.com/questions/8862335/… It looks like a solution that you want Feb 19, 2019 at 12:37
  • @PavelAnikhouski that will not work for me. The string time zone is not known and not limited to a subset. So, I can not hardcode the translation from short time zone string to long time zone string.
    – czlatea
    Feb 19, 2019 at 12:41
  • Possible duplicate of how to get TimeZoneInfo short name
    – pipding
    Feb 19, 2019 at 12:42

2 Answers 2

5

You can't do it. Because for some abbreviations we have several full names: "AMT" means UTC+4 (Armenia Time) also "AMT" means UTC-4 (Amazon Time). That's why Microsoft didn't add this in his TimeZoneInfo class. I think it's much better to talk with the customer and decide which dictionary you will use.

You can find the list of abbreviations here: https://www.timeanddate.com/time/zones/

Sorry for the bad news.

0

Unfortunately it doesn't look like there's a built-in way of doing it. You might find the answer given here to be the simplest solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.