Pentium10
Pentium10

Reputation: 207820

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

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

Upvotes: 0

Views: 1701

Answers (2)

Hans Passant
Hans Passant

Reputation: 941208

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.

Upvotes: 3

ctacke
ctacke

Reputation: 67168

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.

Upvotes: 0

Related Questions