Welcome to MSDN Blogs Sign in | Join | Help

Custom Time Zones in Windows

Someone asked about adding the "Olson" database of timezones to Windows, and I learned about tzedit.exe and the registry keys.  Tzedit.exe is a simple tool that allows you to add or edit the time zone registry entries, which live in the registry at HKLM\Software\Microsoft\Windows NT\CurrentVersion\Time Zones\...

Windows KB 317211 discusses various ways of changing time zone data, but the gist of it is that keys are added or removed from the Time Zones key in the registry.  If one wanted to put the whole Olson database in the registry it should be reasonably straightforward to make a tool to do so (but your time zone drop down would get pretty big so I'm not sure how it'd impact usability).

The cryptic part of the registry information is the "TZI" value, but KB 221542 provides a VB program to muck with time zone data, which defines the following type to describe this data, so that should be helpful.

Private Type REGTIMEZONEINFORMATION
   Bias As Long
   StandardBias As Long
   DaylightBias As Long
   StandardDate As SYSTEMTIME
   DaylightDate As SYSTEMTIME
End Type

So far I'm not aware of any tool that actually imports the Olson data, but by putting together these pieces it should be possible. 

It should be noted that time zone data isn't simple to work with.  Governments keep changing their rules for things like daylight savings time and what the time zone offset should be in which places.  Also these KB articles are referring to shipping versions of Windows, I'm not sure how the behavior may differ in Windows Vista, so caveat programmer.

Published Friday, January 20, 2006 1:32 PM by shawnste

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Custom Time Zones in Windows

Actually, almost done with a custom timezones database based in part on the tzinfo database, but with some tweaks to make it more portable for .Net concentric apps.

What I found in my review of the tzinfo 'Olson' db, and the windows registry, convinced me to develop a solution that could easily be imported into a db, or into a xml files. Where the timezones and timezone rules are kept in the same file, with several files, one for each of the major tzinfo classifications, my implementation uses seperate tzZones, and tzRules files.

The windows registry failing in my opinion, restricts usage of these items to current year, and gives no method to use them for historical reference. With my implementation, I will store time zone daylight saving time rules from 2000-2001 forward.

When this db is complete, it will be distributed as open-source. The development of this db will allow web apps to finally translate a date time into localized formats, including daylight / summer time usage.

If you are interested, drop me an email.

Cheers
Monday, January 30, 2006 5:57 PM by iwonder

# re: Custom Time Zones in Windows

iwonder, I am VERY interested in your solution, and would love to discuss this issue with you.  If you could, please e-mail me at gsmith_lsu (at) yahoo (dot) com
Thursday, March 09, 2006 2:52 PM by Greg Smith

# re: Custom Time Zones in Windows

iwonder, I'd love to see what you have!  I know this would help so many people out.  It's really a shame that this isn't built into the .NET framework.

I'm working on a website for our company, and I'd love to be able to display times in the time zone of the client.  I haven't found a solution that I'm happy with yet, and it sounds like you are heading in the right direction.  I'd love to help out in any way I can.

Greg
Thursday, March 09, 2006 5:01 PM by Greg Smith

# re: Custom Time Zones in Windows

Did you ever complete this database? Is it available?

Friday, July 27, 2007 5:43 PM by SelectStarFrom

# re: Custom Time Zones in Windows

Did you complete this database? Is it available?

Friday, January 11, 2008 9:00 AM by Stafan

# re: Custom Time Zones in Windows

This is how i parse Olson time baby

string ParseOlson(string Olson)

           {

               if (Olson.Contains(":"))

               {

                   Olson = Olson.Split(':')[1];

               }

               return Olson.Substring(0, 4) + "-" + Olson.Substring(4, 2) + "-" + Olson.Substring(6, 2) +" " + Olson.Substring(9, 2) + ":" + Olson.Substring(11, 2);

           }

Thursday, March 27, 2008 3:17 PM by Olson

# I'm not a Klingon : Custom Time Zones in Windows

Someone asked about adding the "Olson" database of timezones to Windows, and I learned about tzedit.exe and the registry keys. Tzedit.exe is a simple tool that allows you to add or edit the time zone registry entries, which live in the registry

Saturday, June 07, 2008 11:07 AM by Relationship Compatibility

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker