Mega Code Archive

 
Categories / VB.Net / Date Time
 

Converts a time from one time zone to another based on time zone identifiers

Module Example    Public Sub Main()                  Dim currentTime As Date = Date.Now         Console.WriteLine("Los Angeles: {0}", TimeZoneInfo.ConvertTimeBySystemTimeZoneId(currentTime, TimeZoneInfo.Local.Id, "Pacific Standard Time"))         Console.WriteLine("Chicago: {0}", TimeZoneInfo.ConvertTimeBySystemTimeZoneId(currentTime, TimeZoneInfo.Local.Id, "Central Standard Time"))             End Sub End Module