Get UTC offset
using System;
class UTCTimeDemo
{
static void Main( )
{
const string headFmt = "{0,-20}{1,-20}{2,-12}{3}";
TimeZone localZone = TimeZone.CurrentTimeZone;
DateTime baseUTC = new DateTime( 2000, 1, 1 );
Console.WriteLine( "\nLocal time: {0}\n", localZone.StandardName );
DateTime localTime = localZone.ToLocalTime( baseUTC );
TimeSpan localOffset = localZone.GetUtcOffset( localTime );
Console.WriteLine(baseUTC);
Console.WriteLine(localTime);
Console.WriteLine(localOffset);
}
}
Related examples in the same category