Saturday, May 28, 2011

If time zones infect your projects, and you've heard of the zoneinfo/tz/Olsen database, then this is .Net API for you...

Diary of a Ninja - How to use ZoneInfo/TZ Time Zones in .Net Applications

"While recently working on the live tile implementation for my Windows Phone 7 hobby project InTheKnow, I had a need to implement Unix Time Zone support using a TZ database. This list of Time Zones is widely used by Unix systems around the world as their source of Time Zone information. Sadly Microsoft’s .Net framework doesn’t have any support for this library – but like other parts of the framework that developers have found to be lacking, there is a library out there to fill the gap.

...

image..."

CodePlex - ZoneInfo (tz database / Olson database) .NET API

"A simple .NET API for the zoneinfo database (also known as the tz database or the Olson database).

The API is designed to load the standard files available from http://www.twinsun.com/tz/tz-link.htm without recompilation, so as the database is updated you just drop it into your product.

For more info on the zoneinfo data refer to http://en.wikipedia.org/wiki/Zoneinfo.

..."

CodeProject - ZoneInfo (tz Database / Olson Database) .NET API

"This article describes a simple .NET API for using the ZoneInfo database, which is also known as the tz database or Olson database.

The API is available here.

I hope you find it useful. :)

Background

I have been developing a web site which schedules meetings and events across multiple time zones for more than a year now.

I previously used the .NET PublicDomain library discussed in another CodeProject article but had a number of issues including:

  • Just not working for Australia
  • It seems to hard code in the tz database rather than reading it from the file system; therefore if you need to update the database, you need to wait for the source code to be updated
  • The library seems to have a lot of other things in it which I just don't need (which is not a major issue though)

One of the big things I wanted was to have an API by which I can just download the latest tz database and off I go.

I am not a big fan of reinventing the wheel so if this library just isn't needed, PLEASE let me know. :)

Using the Code

Talking a fairly agile approach to this, I have just implemented the APIs which I have needed.

The interface itself is extremely simple and hopefully is well illustrated by the examples below.

..."

If you know about the tz/Olsen database then you might find this library interesting. If you don't then this means nothing to you... lol  :P

No comments: