0

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 :)

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
eestein
  • 4,914
  • 8
  • 54
  • 93

1 Answers1

1

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.

Community
  • 1
  • 1
Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
  • Actually, it's the only option. The Dynamics Timezone values are completely arbitrary – Panagiotis Kanavos Jun 30 '15 at 07:18
  • Well, thank you for the answer... since I did my research before asking I was prepared for that =/ well, monkey job ahead... Thanks – eestein Jun 30 '15 at 11:41
  • I recently stumbled upon this as well and just started a git repo https://github.com/joacar/MicrosoftDynamics. Less developers doing monkey job is more happier developers :) – joacar Mar 24 '16 at 13:41