Ok, I'm just going to offer this information, even though there just doesn't seem to be a whole lot of interest, which is surprising to me, given the global acceptance of .Net, not just DNN. Of course, I could be misreading the situation, and most are satisfied with the status quo. Maybe it's the poster, and not the topic (always a possibility). In any event, here's what I've been thinking about...
Towards A Solution
Key Goals
1. Provide an easily localizable list of time zone information.
2. Include rules that auto-adjust date time information using reference rules for the the following: unauthenticated user (portal preference), authenticated user (user preference).
3. Include ability to store/retrieve historical time zone references
4. Support the minimum 75 time zones already available in the Windows registry, but do not limit the solution to only 75 time zones.
5. Assimilate TZInfo where appropriate. It may not be practical to implement all known information from the TZInfo database. Might need to offer a method for Hosts or Admins to specify which Time Zones are supported.
6. Avoid complicating storage methods, enumerate with simple encoding, rather than structures that are used for internal storage.
7. Include longitude and latitude of Time Zone description, which could be very useful for future development.
8. Publish limitations on usage. For example, a practical solution for DNN may not offer auto-conversion of data prior to 2003 and may not display accurate date time information for years beyond the current year + 6 months. Time Zone information varies according to no set standard reference, and therefore cannot accurately assume that rules engaged beyond these limitations will be correct. Discretionary use is advised.
Why Can’t The Windows Registry Timezones be used?
First, and foremost the 75 windows registry timezones only are setup to support current year. Meaning that there is no historical reference. In fact, when a given locale changes their time zone daylight saving (summer time) rules, these rules need to be manually ‘fixed’ in the registry. These types of corrections are not distributed by Microsoft as updates to anyone. The corrections appear in KB articles, but the corrections could easily be missed by folks that are not in the locale affected. As each year starts, new rules are in place, which may not calculate the correct date time adjustments for any past years. Actually, any date time adjustment based on the registry alone results in a date time factored with the current years’ rules. Not exactly the result time sensitive sites would require.
Secondly, the windows registry is not totally accurate. Independent tests show it to be around 75-80% accurate at any point in time. Also, the time zones do not represent every time zone on the globe, just the more commonly used zones are included. The UNIX / Linux TZInfo database includes many more time zone descriptions, but there is a question of just how many require support. Obviously, MS made the determination that only 75 of the more than 108 zones in the TZInfo database really require support. It’s a question of judgement.
Lastly, web applications are not really meant to have access to the windows registry. It’s really a question of security, but I can’t imagine any host provider wanting to allow a web application to manipulate the registry. In fact, I’m not sure if the Code Access Security model will even allow the type of registry read and write permission required to effectively use and maintain a registry timezone information.
Why not use the TZInfo database for the solution?
That’s not an easy solution to manage either. First of all, there is no single authorative time zone source. Yes, the TZInfo database has the distinction of being the most inclusive database of time zone information, however, it is not the sole authority. The TZInfo database was built over the years with contributions from various sources, and there is no assurance that the information is 100% correct.
For historical references, the Olson database, as it is also known, is unmatched, but in general any daylight saving time rules before 1970 are suspect. Even in the USA, daylight saving time practices varied from locale to locale, and sometimes cities less than 30 miles from each other had different rules for using or not using DST.
Now, with all of that history, it seems more important to build on what the TZInfo database has collected, and integrate a more valid approach for future use. While working to incorporate the full TZInfo database into a .Net solution might be desireable, it really may not be practical or worthwhile, given the lack of accuracy inherent in the data, conversion issues aside.
Finally, any .Net solution has a requirement to be easily localizable, something which I’m not sure is possible with the TZInfo database.
Why not use Michael Brumm’s SimpleTimeZone Class?
While the SimpleTimeZone class fills a certain void in the .Net classes to support time zones. Again, the class would seemingly have issues with operating in less than full trust mode when used in conjunction with reading the windows registry. As mentioned above, the registry only provides information for the current year. So, the SimpleTimeZone class is a useful model for building a solution, but is not the lone answer either, unless a database of time zone information other than the registry is used.
Why not build a .Net time zone database?
Precisely! It seems to be the only answer that leads to including all of the requirements of a .Net solution. However, building a time zone database is not an easy task either. First, question is how many years back does the database support? How many time zones does the database need to include? What format should the database be in?
These are just some of the issues to overcome. I’m sure others are going to pop up as the process gets rolling. In the end, it’s just a question of time, isn’t it?
Now, if you are wondering what the TZInfo database or Michael Brumm's SimpleTimeZone class are about, just do an internet search. Maybe, you didn't know that most .Net web apps are not really showing you the date time you think they were. Should you care? Only if you care about a certain degree of precision in presenting date time information.
Now back to my reqularly scheduled support activities...
Cheers