Importance of TimeZoneInfo class in ASP.NET


You are working on an ASP.NET application which is hosted in a server in a USA time zone.You need to send an email to your customers daily at 10 AM in the Singapore time zone. How is that possible?

How to get all the timezones 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, convert datetime values between time zones etc.


The important properties or methods are described below:

LocalStatic PropertyGets the current TimeZoneInfo of machine
GetSystemTimeZones()Static MethodReturns the list of world TimeZoneInfo available
ConvertTime()Static MethodConverts time in one zone to another
IdInstance PropertyString identifier of TimeZoneInfo
DisplayNameInstance PropertyDisplay name in localized text
GetUtcOffset()Instance MethodReturns 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.