ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

C# program for TimeZoneInfo.SupportsDaylightSavingTime Property

Here, we are going to demonstrate an example for TimeZoneInfo.SupportsDaylightSavingTime Property in C#.Net.
Submitted by Nidhi, on May 07, 2021

The SupportesDaylightSavingTime property of TimeZoneInfo class is used to check whether the time zone has any daylight-saving time rules or not.

Syntax:

    bool TimeZoneInfo.SupportsDaylightSavingTime

Return value:

It returns a boolean value that denotes available time zones are daylight-saving time rules or not. If the time zone supports daylight time, then it returns true otherwise it returns false.

Program:

The source code to demonstrate the example for TimeZoneInfo.SupportsDaylightSavingTime Property 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()
    {
        ReadOnlyCollection<TimeZoneInfo> timeZones;

        timeZones = TimeZoneInfo.GetSystemTimeZones();

        Console.WriteLine("Supported daylight saving time:");
        foreach (TimeZoneInfo timeZone in timeZones)
        {
            if (!timeZone.SupportsDaylightSavingTime)
                Console.WriteLine("\t"+timeZone.DisplayName);
        }
    }
}

Output:

Supported daylight saving time:
        (UTC-12:00) International Date Line West
        (UTC-11:00) Midway Island, Samoa
        (UTC-10:00) Hawaii
        (UTC-07:00) Arizona
        (UTC-06:00) Central America
        (UTC-06:00) Saskatchewan
        (UTC-05:00) Bogota, Lima, Quito
        (UTC-05:00) Indiana (East)
        (UTC-04:30) Caracas
        (UTC-04:00) Georgetown, La Paz, San Juan
        (UTC-03:00) Cayenne
        (UTC-01:00) Cape Verde Is.
        (UTC) Coordinated Universal Time
        (UTC) Monrovia, Reykjavik
        (UTC+01:00) West Central Africa
        (UTC+02:00) Harare, Pretoria
        (UTC+03:00) Kuwait, Riyadh
        (UTC+03:00) Nairobi
        (UTC+03:00) Tbilisi
        (UTC+04:00) Abu Dhabi, Muscat
        (UTC+04:30) Kabul
        (UTC+05:00) Tashkent
        (UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi
        (UTC+05:30) Sri Jayawardenepura
        (UTC+05:45) Kathmandu
        (UTC+06:00) Astana, Dhaka
        (UTC+06:30) Yangon (Rangoon)
        (UTC+07:00) Bangkok, Hanoi, Jakarta
        (UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi
        (UTC+08:00) Kuala Lumpur, Singapore
        (UTC+08:00) Taipei
        (UTC+09:00) Osaka, Sapporo, Tokyo
        (UTC+09:00) Seoul
        (UTC+09:30) Darwin
        (UTC+10:00) Brisbane
        (UTC+10:00) Guam, Port Moresby
        (UTC+11:00) Magadan, Solomon Is., New Caledonia
        (UTC+12:00) Fiji, Marshall Is.
        (UTC+13:00) Nuku'alofa
Press any key to continue . . .

C# TimeZoneInfo Class Programs »

ADVERTISEMENT




Comments and Discussions

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.