简体   繁体   English

如何将Dynamics AX时区转换为C#TimeZoneInfo?

[英]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#. 我需要将Dynamics AX 2012 R3上的时区转换为C#上的TimeZoneInfo I'm doing this on my C# code. 我正在我的C#代码上执行此操作。 I get an int from Dynamics ( Timezone enum). 我从Dynamics( 时区枚举)获得了一个整数。

I get the Timezone enum from table LogisticsPostalAddress . 我从表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. 我找不到太多的信息,我真的很想避免创建一个对每种可能性都执行从X到Y的代码。 Would I be able to use that Value provided at the referenced link? 我可以使用引用链接中提供的值吗? Thanks :) 谢谢 :)

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 . 听起来并不酷,但是我认为您必须自己提供时区系统枚举和有效实例化TimeZoneInfo Object的名称之间的映射表。

The list of names should be quite static, but remember to catch TimeZoneNotFoundException and InvalidTimeZoneException when using FindSystemTimeZoneById . 名称列表应该是非常静态的,但是记住在使用FindSystemTimeZoneById时要捕获TimeZoneNotFoundExceptionInvalidTimeZoneException

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM