开发者

How to get regional timezone on Compact Framework and then convert UTC date to local date?

开发者 https://www.devze.com 2022-12-20 11:31 出处:网络
How to get regional timezone on Compact Framework and then co开发者_JAVA百科nvert UTC date to local date?The DateTime.ToLocalTime() method is available on CF, no need to jump through hoops.Do make sur

How to get regional timezone on Compact Framework and then co开发者_JAVA百科nvert UTC date to local date?


The DateTime.ToLocalTime() method is available on CF, no need to jump through hoops. Do make sure to use a DateTime constructor that takes a DateTimeKind argument so you can tell it that it's a UTC time, if necessary.


P/Invoke GetTimeZoneInformation to get the current timezone biases, then use those to offset the UTC time.

Alternately you could use the DateTimeHelper.GetTimezoneInformation call in the SDF.

0

精彩评论

暂无评论...
验证码 换一张
取 消