Mega Code Archive

 
Categories / VB.Net / Date Time
 

Converts a Coordinated Universal Time (UTC) to the time in a specified time zone

Module Example    Public Sub Main()         Dim timeUtc As Date = Date.UtcNow         Dim cstZone As TimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time")         Dim cstTime As Date = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, cstZone)         Console.WriteLine("The date and time are {0} {1}.", _                              cstTime, _                              IIf(cstZone.IsDaylightSavingTime(cstTime), _                                  cstZone.DaylightName, cstZone.StandardName))    End Sub End Module