The short time zone string I'm getting it as input. I'm trying to avoid to hardcode myself a huge mapping.
-
~Can you give an example of the type of "short" value you're expecting?~ Sorry, I just saw that's in the title.– Martin CostelloFeb 19, 2019 at 12:28
-
Check this thread stackoverflow.com/questions/8862335/… It looks like a solution that you want– Pavel AnikhouskiFeb 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.– czlateaFeb 19, 2019 at 12:41
-
Possible duplicate of how to get TimeZoneInfo short name– pipdingFeb 19, 2019 at 12:42
2 Answers
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.
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