C# - TimeZoneInfo.DaylightName Property with Example

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

TimeZoneInfo.DaylightName Property

The TimeZoneInfo.DaylightName property is used to get the display name for the current time zone's daylight-saving time.

Syntax

string TimeZoneInfo.DaylightName

Parameter(s)

  • None

Return Value

It returns a string value that denotes daylight saving time of the local time zone.

C# Example of TimeZoneInfo.DaylightName Property

The source code to get the display name for the current time zone's daylight saving time is given below. The given program is compiled and executed successfully.

using System;
using System.Globalization;

class TimeZoneInfoDemo {
  //Entry point of Program
  static public void Main() {
    string dayLightName = "";
    TimeZoneInfo localTimeZone;

    localTimeZone = TimeZoneInfo.Local;
    dayLightName = localTimeZone.DaylightName;

    Console.WriteLine("DayLightName of Local Time Zone:\n" + dayLightName);
  }
}

Output

DayLightName of Local Time Zone:
India Daylight Time
Press any key to continue . . .

C# TimeZoneInfo Class Programs »





Comments and Discussions!

Load comments ↻





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