TimeZones
Right now, there is no easy way to convert a time from one arbitrary timezone to another arbitrary timezone in .NET. Certainly you can convert from UTC to the local system time, or from the local system time to UTC. But how do you convert from PST to EST?
Well Scott Hanselman recently pointed me to some ingenious code in DasBlog originally written by Clemens Vasters that does this. I recently submitted a patch to DasBlog so that this code properly handles daylight savings and I had planned to blog about it in more detail later. Unfortunately, we recently found out that changes in Vista may break this particular approach.
It turns out that the Orcas release introduces a new TimeZone2
class.
This class will finally allow conversions between arbitrary timezones.
Krzysztof Cwalina (who wins the award for Microsoft blogger with the highest consonants to vowel ration in a first name) points out that many people are not thrilled with the “2” suffix and provides context on the naming choice.
Kathy Kam of the BCL team points out some other proposed
names
for the new TimeZone2
class and the problems with each.
I’m fine with TimeZone2
or TimeZoneRegion
.
Comments
8 responses