For anyone who’s tried to convert a DateTime/DateTimeOffset to another time zone in a Windows Store style app, I’ve put together a helper class that uses some of the Win32 APIs that are allowed in Store apps.

UPDATE 10/16: I’ve created a NuGet package with a generic version, please use that instead as it already has significant bug fixes.

In the code below, I’m converting all times to be Eastern time, but it can be easily adapted more generically. I’m calling the Win32 functions that take changes in daylight time into account, so it should be accurate for any supplied date.

The TimeZoneKeyNames are in the registry in the following location:

         Windows NT
               Time Zones
                     Dynamic DST

The code is based on DateTimeOffset’s as DateTime isn’t allowed as a public type in a Windows Runtime component. Using this code, you can display a list of system time zones. You can also pass in a current DateTimeOffset or DateTime (make sure you have it correctly marked as either UTC or Local) and convert it to a DateTimeOffset in another timezone.

Hopefully this will help someone or can be included as part of a bigger utility library.