ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

C# program for TimeZoneInfo.Id property & TimeZoneInfo.GetSystemTimeZones() method

Here, we are going to demonstrate an example for TimeZoneInfo.Id property & TimeZoneInfo.GetSystemTimeZones() method in C#.Net.
Submitted by Nidhi, on May 06, 2021

TimeZoneInfo.Id property is used to get the time zone identifier.

TimeZoneInfo.GetSystemTimeZones() method is used to get a sorted collection of all the time zones available on the local system.

Syntax:

    ReadOnlyCollection TimeZoneInfo.GetSystemTimeZones();
    
    TimeZoneInfo TimeZoneInfo.Id;

Program:

The source code to demonstrate TimeZoneInfo.Id property & TimeZoneInfo.GetSystemTimeZones() method 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("TimeZones:");
        foreach (TimeZoneInfo timeZone in timeZones)
            Console.WriteLine("\t"+timeZone.Id);
    }
}

Output:

TimeZones:
        Dateline Standard Time
        Samoa Standard Time
        Hawaiian Standard Time
        Alaskan Standard Time
        Pacific Standard Time
        Pacific Standard Time (Mexico)
        US Mountain Standard Time
        Mountain Standard Time (Mexico)
        Mountain Standard Time
        Central America Standard Time
        Central Standard Time
        Central Standard Time (Mexico)
        Canada Central Standard Time
        SA Pacific Standard Time
        Eastern Standard Time
        US Eastern Standard Time
        Venezuela Standard Time
        Paraguay Standard Time
        Atlantic Standard Time
        SA Western Standard Time
        Central Brazilian Standard Time
        Pacific SA Standard Time
        Newfoundland Standard Time
        E. South America Standard Time
        Argentina Standard Time
        SA Eastern Standard Time
        Greenland Standard Time
        Montevideo Standard Time
        Mid-Atlantic Standard Time
        Azores Standard Time
        Cape Verde Standard Time
        Morocco Standard Time
        UTC
        GMT Standard Time
        Greenwich Standard Time
        W. Europe Standard Time
        Central Europe Standard Time
        Romance Standard Time
        Central European Standard Time
        W. Central Africa Standard Time
        Jordan Standard Time
        GTB Standard Time
        Middle East Standard Time
        Egypt Standard Time
        South Africa Standard Time
        FLE Standard Time
        Israel Standard Time
        E. Europe Standard Time
        Namibia Standard Time
        Arabic Standard Time
        Arab Standard Time
        Russian Standard Time
        E. Africa Standard Time
        Georgian Standard Time
        Iran Standard Time
        Arabian Standard Time
        Azerbaijan Standard Time
        Mauritius Standard Time
        Caucasus Standard Time
        Afghanistan Standard Time
        Ekaterinburg Standard Time
        Pakistan Standard Time
        West Asia Standard Time
        India Standard Time
        Sri Lanka Standard Time
        Nepal Standard Time
        N. Central Asia Standard Time
        Central Asia Standard Time
        Myanmar Standard Time
        SE Asia Standard Time
        North Asia Standard Time
        China Standard Time
        North Asia East Standard Time
        Singapore Standard Time
        W. Australia Standard Time
        Taipei Standard Time
        Tokyo Standard Time
        Korea Standard Time
        Yakutsk Standard Time
        Cen. Australia Standard Time
        AUS Central Standard Time
        E. Australia Standard Time
        AUS Eastern Standard Time
        West Pacific Standard Time
        Tasmania Standard Time
        Vladivostok Standard Time
        Central Pacific Standard Time
        New Zealand Standard Time
        Fiji Standard Time
        Kamchatka Standard Time
        Tonga Standard Time
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.