eestein
eestein

Reputation: 5114

How to convert Dynamics AX Timezone to C# TimeZoneInfo?

I need to convert a Timezone on Dynamics AX 2012 R3 to a TimeZoneInfo on C#. I'm doing this on my C# code. I get an int from Dynamics (Timezone enum).

I get the Timezone enum from table LogisticsPostalAddress.

Are there any methods to convert it? I couldn't find much information on that and I'd really like to avoid creating a code that would do a from X to Y for every single possibility. Would I be able to use that Value provided at the referenced link? Thanks :)

Upvotes: 0

Views: 449

Answers (1)

Jan B. Kjeldsen
Jan B. Kjeldsen

Reputation: 18051

It does not sound cool, but I think you will have to provide the mapping table yourself between the Timezone System Enumeration and the name valid to Instantiate a TimeZoneInfo Object.

The list of names should be quite static, but remember to catch TimeZoneNotFoundException and InvalidTimeZoneException when using FindSystemTimeZoneById.

Upvotes: 1

Related Questions