List time zones in ASP.NET

Dec 19, 2006

If you need a list of time zones for your user to pick from, you probably want a dropdown list. Then you just need a list of time zones to bind to the dropdown list. Unfortunately, the System.TimeZone class doesn’t provide us with such a list and there is actually no where in the .NET Framework you will find it. It is very strange and also annoying because we are getting pretty used to find almost everything we need in the framework.

This means that we have to create the dropdown list our selves, which is a pretty trivial job. I took me a while to do some time ago. You can download the populated dropdown list below.

Download

timezones.txt (2,6 KB)

* $4.95/month BlogEngine.net Hosting – Click Here!

Comments (3) -

 David Gardiner
David Gardiner
12/20/2006 1:03:16 AM #

I've found Michael Brumm's timezone library very useful - http://www.michaelbrumm.com/simpletimezone.html

It retrieves the info directly from Windows Registry so you're always getting the latest info (eg. Western Australia recently introduced daylight savings, so their timezone info has been updated).

I did discover recently that Michael's library need a few minor updates to get it to work with Vista (and presumably Longhorn) due to some changes in how Microsoft store timezone data in the registry.

-dave

Mads Kristensen
Mads Kristensen
12/20/2006 6:17:42 AM #

I actually saw an article describing how to get time zones from the Windows Registry, but it seems to be such an strange way of during something that is supposed to be so simple. It is not something I want in my ASP.NET web page - just a personal preference.

vivek
vivek India
8/5/2008 11:04:20 AM #

Thats Great!!!!!!!!!!!!
Thank you Mads..............

Comments are closed

About the author

Mads Kristensen

Mads Kristensen
Program Manager at the Microsoft Web Platform team and founder of BlogEngine.NET.

More...

Month List

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer’s view in any way.