Converting from UTC to Local & Local to UTC using .NET Framework
Converting dates from or to UTC in the .NET Framework is pretty simple as the DateTime class has many built in features including many conversion related functions.
Example .NET Framework Date Conversion Code ( UTC / Local )
The .NET code for performing the UTC to local and back conversion is listed below.
// Get date for current moment adjusted for local time zone. DateTime utcNow = DateTime.UtcNow; DateTime localNow = DateTime.Now; // convert the UTC date to Local newDate = DateTime.SpecifyKind( utcNow, DateTimeKind.Local ); // convert the Local time to UTC newDate = DateTime.SpecifyKind( localNow, DateTimeKind.Utc );