VB.NET Time Zones
If you have signed up for our Microsoft Visual Basic .NET - The Complete Course, The lesson for Chapter 7 has an assignment to create a clock that can display the local time in different time zones.
Simple? Right?
Maybe not.
In writing the assignment, I ran into this comment at the Microsoft sponsored site: gotdotnet:
Does the .NET Framework support Time Zone conversions to any given Time Zone?
Not in V1.0, V1.1 or the Whidbey pre-release.
The .NET Framework does support conversion to and from UTC and the systems current local time. It can also support parsing a DateTime from an arbitrary time zone offset, such as 2003-10-26T13:11:07+10:00, but it must always convert this either to Local or UTC.
This is a very common feature request and is likely to be in a future version.
People are often surprised why this feature cannot be supplied by Microsoft at low cost. In particular, data to do conversions exists in the Windows registry and is used by the time zone selection dialog. However, there is a big distinction between having UI and registry data and having an API.
This is a more expensive feature to undertake for Microsoft than most people would imagine because (a) an API must provide consistent behavior from one machine to another so we cant just re-expose the registry data and (b) there is cost for Microsoft in exposing an official Time Zone conversion because we face on-going geo-political costs for any country/region based data we gather and maintain. For example, a country may threaten to boycott our product if they are not listed in the data. This has happened to us with our CultureInfo data on many occasions, and we often need to tweak data in service packs, which is expensive and risky.
That being said, there is agreement that this is a very important feature, and it is under serious consideration for the WinFx release.
Even Microsoft has trouble with international relationships!
For all of you VB 6 people, there are lots of time zone conversion utilities available on that platform!
If you want to see how I solved the problem, sign up for our Microsoft Visual Basic .NET - The Complete Course. It's in the lesson for Chapter 8.


Comments
No comments yet. Leave a Comment