Home »
.Net »
C# Programs
C# program to get the Coordinated Universal Time (UTC) zone (TimeZoneInfo.Utc Property)
C# TimeZoneInfo.Utc Property: Here, we are going to learn how to TimeZoneInfo.Utc Property in C#.Net?
Submitted by Nidhi, on May 07, 2021
The Utc property of TimeZoneInfo class is a static property that represents the Coordinated Universal Time (UTC) zone.
Syntax:
TimeZoneInfo TimeZoneInfo.Utc
Return value:
It returns the object of TimeZoneInfo class that represents Coordinated universal time(UTC).
Program:
The source code to get the Coordinated Universal Time (UTC) zone 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 universalTimeZone;
universalTimeZone = TimeZoneInfo.Utc;
Console.WriteLine("The universal time zone: " +universalTimeZone.DisplayName);
Console.WriteLine("Daylight savings name: " +universalTimeZone.DaylightName);
Console.WriteLine("Standard name: " +universalTimeZone.StandardName);
}
}
Output:
The universal time zone: UTC
Daylight savings name: UTC
Standard name: UTC
Press any key to continue . . .
C# TimeZoneInfo Class Programs »