In this post we will be discussing about getting the Timezone ID's in C#. There might be scenario where you need to give the exact Timezone Id when using TimeZoneInfo.FindTimeZoneById() or TimeZoneInfo.FindSystemTimeZoneById(), so for you need to know the exact id's of all the timezone.
class Program
{
static void Main(string[] args)
{
foreach(TimeZoneInfo tz in TimeZoneInfo.GetSystemTimeZones())
{
Console.WriteLine(tz.Id);
}
}
}
Along with that if you want to know the UTC Offset Value, or Standard Name or Display Name you can use tz.BaseUtcOffset, tz.StandardName or tz.DisplayName). This will give the result as :
For more information about Time Zone Index Values you can refer to the MSDN which has the concise Time Zone values as shown below.
Please Like and Share the CodingDefined.com Blog, if you find it interesting and helpful.
Code to Get Timezone ID's is :
class Program
{
static void Main(string[] args)
{
foreach(TimeZoneInfo tz in TimeZoneInfo.GetSystemTimeZones())
{
Console.WriteLine(tz.Id);
}
}
}
Along with that if you want to know the UTC Offset Value, or Standard Name or Display Name you can use tz.BaseUtcOffset, tz.StandardName or tz.DisplayName). This will give the result as :
For more information about Time Zone Index Values you can refer to the MSDN which has the concise Time Zone values as shown below.
Please Like and Share the CodingDefined.com Blog, if you find it interesting and helpful.
Related articles
- Install Tools for Apache Cordova in Visual Studio 2015
- CodeLobster PHP Edition - Free PHP IDE
- HTML5 Responsive Frameworks for Web Developers
- Online Javascript Editors for Developers
- What is Apache Cordova and Ionic Framework
- Basic Introduction to AngularJS
- HTML5 Syntax's Simplicity
- Starting with TypeScript
- Getting Started with BootStrap
- IonicLab for Windows
No comments:
Post a Comment