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 HKLMSoftwareMicrosoftWindows NTCurrentVersionTime 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.
Comments
Anonymous
January 30, 2006
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.
CheersAnonymous
March 09, 2006
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) comAnonymous
March 09, 2006
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.
GregAnonymous
July 27, 2007
Did you ever complete this database? Is it available?Anonymous
January 11, 2008
Did you complete this database? Is it available?Anonymous
March 27, 2008
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); }Anonymous
June 07, 2008
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