100% Australian Windows Web Hosting
  • Knowledge Base

Converting dates between Time Zones 

Was this helpful? (0) (0)

The following is an example function that takes a Date object and converts it to a different Time Zone.
This function uses the TimeZoneInfo object available in .NET 3.5 and .NET 4

A list of time zone Ids can be found by using the TimeZoneInfo.GetSystemTimeZones function.

Private Function GetDateInTimezone(dDate As Date, timeZoneID As String) As Date
Return TimeZoneInfo.ConvertTime(dDate, TimeZoneInfo
End Function

For example, to convert the time to "AUS Eastern Standard Time" (which includes daylight saving adjustments), use the following:

GetDateInTimezone(Now, "AUS Eastern Standard Time")