Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Importance of TimeZoneInfo class

Posted by Paul on February 3, 2011

I would like to take your attention on the following problems.

You are working on an ASP.NET application which is hosted in a server under USA time zone?

You need to send an email to your customers daily at Singapore time zone 10 AM. How is that possible?

How to get all the time zones in the current system?

What is the current time zone Id?

The answers for all these questions would be the TimeZoneInfo class.


The TimeZoneInfo class represents any time zone in the world. It contains a set of static methods/properties that allows us to get the current time zone information, conversion of datetime between time zones etc.


The important properties or methods are described below:





Static Property

Gets the current TimeZoneInfo of machine


Static Method

Returns the list of world TimeZoneInfo available


Static Method

Converts time in one zone to another


Instance Property

String identifier of TimeZoneInfo


Instance Property

Display name in localized text


Instance Method

Returns the difference in timezone difference with Universal Time (UTC)

The Test Application

The test application attached provides:

· Information on Current Time Zone

· Displays list of TimeZoneInfo available


Converting current datetime to another TimeZone

So what about converting the current time to another time zone?

Here is the answer: Use the TimeZoneInfo.ConvertTime() method.

Code Example:

TimeZoneInfo timeZone = TimeZoneInfo.GetSystemTimeZones().Where(t => t.Id == “Central Standard Time”).First();

DateTime newTime = TimeZoneInfo.ConvertTime(DateTime.Now, timeZone);

The method ConvertTime() takes the current time and new time zone as arguments.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s