Simple Time Zone For All Countries Using C# Code

Here, I have created a Windows Application, where you are able to see few countries current time zone.
 
In one of my project, it was required to set the time zone of different countries, so it was very difficult to find the country's current timezone in few seconds. Thus, I thought, it's better to develop a program, where every one can easily see the country time zone.
 
Please look into the steps given below, where I have develped a prgram, using C# code.
 
I opened Visual Studio, created an Empty Project and name of the project is Country Time Zone.
 


Simply drag and drop labels from Toolbox under menu in Visual Studio. Afterwards, design your page, as per your requirement.
 
Afterwards, add Timer control at the end of the page because it will update the time automatically. Once you drop Timers at the end of the page, set the few properties.

Enable: Default: False : Change to True.
Interval : Default:1000: Change to 20.

 
 
Once you set the properties, double click on Timer control and it will redirect to Code view. Please check the code given below to show current time zone of the different countries. 
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Drawing;  
  6. using System.Globalization;  
  7. using System.Linq;  
  8. using System.Text;  
  9. using System.Threading.Tasks;  
  10. using System.Windows.Forms;  
  11.   
  12. namespace getNotepadFile  
  13. {  
  14.     public partial class CountryTime : Form  
  15.     {  
  16.         public CountryTime()  
  17.         {  
  18.             InitializeComponent();  
  19.         }  
  20.   
  21.         private void timer1_Tick(object sender, EventArgs e)  
  22.         {  
  23.   
  24.             var inTimeZone = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");  
  25.             DateTime inTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, inTimeZone);  
  26.             label2.Text = Convert.ToString(inTime);  
  27.   
  28.   
  29.   
  30.         }  
  31.   
  32.         private void timer2_Tick(object sender, EventArgs e)  
  33.         {  
  34.             var euTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");  
  35.             DateTime euTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, euTimeZone);  
  36.             label3.Text = Convert.ToString(euTime);  
  37.   
  38.         }  
  39.   
  40.         private void timer4_Tick(object sender, EventArgs e)  
  41.         {  
  42.             var ukTimeZone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");  
  43.             DateTime ukTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, ukTimeZone);  
  44.             label21.Text = Convert.ToString(ukTime);  
  45.   
  46.         }  
  47.   
  48.         private void timer10_Tick(object sender, EventArgs e)  
  49.         {  
  50.             var euTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");  
  51.             DateTime euTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, euTimeZone);  
  52.             label13.Text = Convert.ToString(euTime);  
  53.         }  
  54.   
  55.         private void timer11_Tick(object sender, EventArgs e)  
  56.         {  
  57.             var siTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Singapore Standard Time");  
  58.             DateTime siTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, siTimeZone);  
  59.             label15.Text = Convert.ToString(siTime);  
  60.   
  61.         }  
  62.   
  63.         private void timer9_Tick(object sender, EventArgs e)  
  64.         {  
  65.             var MaTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Mountain Standard Time");  
  66.             DateTime MaTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, MaTimeZone);  
  67.             label7.Text = Convert.ToString(MaTime);  
  68.         }  
  69.   
  70.         private void timer3_Tick(object sender, EventArgs e)  
  71.         {  
  72.               
  73.             var AmTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central America Standard Time");  
  74.             DateTime AmTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, AmTimeZone);  
  75.             label9.Text = Convert.ToString(AmTime);  
  76.         }  
  77.   
  78.         private void timer13_Tick(object sender, EventArgs e)  
  79.         {  
  80.               
  81.             var SoTimeZone = TimeZoneInfo.FindSystemTimeZoneById("South Africa Standard Time");  
  82.             DateTime SoTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, SoTimeZone);  
  83.             label19.Text = Convert.ToString(SoTime);  
  84.         }  
  85.   
  86.         private void timer12_Tick(object sender, EventArgs e)  
  87.         {  
  88.               
  89.             var ArTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Arabian Standard Time");  
  90.             DateTime ArTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, ArTimeZone);  
  91.             label17.Text = Convert.ToString(ArTime);  
  92.         }  
  93.   
  94.         private void timer8_Tick(object sender, EventArgs e)  
  95.         {  
  96.               
  97.             var ChTimeZone = TimeZoneInfo.FindSystemTimeZoneById("China Standard Time");  
  98.             DateTime ChTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, ChTimeZone);  
  99.             label23.Text = Convert.ToString(ChTime);  
  100.         }  
  101.   
  102.         private void timer6_Tick(object sender, EventArgs e)  
  103.         {  
  104.               
  105.             var BnTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Bangladesh Standard Time");  
  106.             DateTime BaTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, BnTimeZone);  
  107.             label25.Text = Convert.ToString(BaTime);  
  108.         }  
  109.   
  110.         private void timer7_Tick(object sender, EventArgs e)  
  111.         {  
  112.             var CaTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Canada Central Standard Time");  
  113.             DateTime CaTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, CaTimeZone);  
  114.             label5.Text = Convert.ToString(CaTime);  
  115.   
  116.         }  
  117.   
  118.         private void timer5_Tick(object sender, EventArgs e)  
  119.         {  
  120.             var BrTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central Brazilian Standard Time");  
  121.             DateTime BrTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, BrTimeZone);  
  122.             label11.Text = Convert.ToString(BrTime);  
  123.   
  124.         }  
  125.     }  
  126. }  
Once you completed the code, Debug the prgram on top of Visual Studio. Please look into the images
given below for the output.
 
 
 
Please let me know, if anyone is facing any problem.