C# - TimeZoneInfo.Utc Property with Example

In this tutorial, we will learn about the C# TimeZoneInfo.Utc property with its definition, usage, syntax, and example. By Nidhi Last updated : March 31, 2023

TimeZoneInfo.Utc Property

The TimeZoneInfo.Utc is a static property that represents the Coordinated Universal Time (UTC) zone.

Syntax

TimeZoneInfo TimeZoneInfo.Utc

Parameter(s)

  • None

Return Value

It returns the object of TimeZoneInfo class that represents Coordinated universal time(UTC).

C# Example of TimeZoneInfo.Utc Property

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 »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.