The source code to calculate the offset between the time in this time zone and UTC is given below. The given program is compiled and executed successfully.
using System;
using System.Globalization;
using System.Collections.ObjectModel;
class TimeZoneInfoDemo
{
//Entry point of Program
static public void Main()
{
TimeZoneInfo cst;
TimeZoneInfo utc;
DateTime time;
TimeSpan offset;
time = new DateTime(2020, 1, 1, 12, 30, 30);
cst = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
utc = TimeZoneInfo.Utc;
offset = utc.GetUtcOffset(time);
Console.WriteLine("UTC Time Offset: "+offset);
offset = cst.GetUtcOffset(time);
Console.WriteLine("CST Time Offset: "+offset);
}
}
Output:
UTC Time Offset: 00:00:00
CST Time Offset: -06:00:00
Press any key to continue . . .
Program:
The source code to calculate the offset between the time in this time zone and UTC is given below. The given program is compiled and executed successfully.
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer