| Printable Version
World Timings using Windows Application in C#
By Raju Pericharla
I developed a C# application for finding World Timings given the US Central
Timing.
I have used several labels and textboxes, one group box and
two buttons in this Windows application. I have used labels
to label all Time Zones, textboxes to display their corresponding
timings and group box to group all labels and text boxes .
I used two buttons : One to get the corresponding time for that time zone
and the second is Exit button to exit the application.
The first text box takes the date and time of US Central timing
in this format: 2/2/2002 6:00:00 OR 6:00:00 (In this case it
will take today’s date) OR 2/2/2002 (In this case it will consider
as midnight time of US Central Timing). If you didn’t follow these
formats it will give an unexceptional handling error. After
pressing the getTime button it will calculate the date and
time for all time zones. In the code I used DateTime Constructor to
Convert string in the textbox1 into date and date back again into string.
To run this , copy the below code and run it in Windows Application of
C# in VisualStudio.net . Comments are welcome. My email is
pericharla_raju@hotmail.com
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WorldTimings
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.RichTextBox richTextBox2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.PrintPreviewDialog printPreviewDialog1;
private System.Windows.Forms.RichTextBox richTextBox3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.RichTextBox richTextBox4;
private System.Windows.Forms.RichTextBox richTextBox5;
private System.Windows.Forms.RichTextBox richTextBox6;
private System.Windows.Forms.RichTextBox richTextBox7;
private System.Windows.Forms.RichTextBox richTextBox8;
private System.Windows.Forms.RichTextBox richTextBox9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.RichTextBox richTextBox10;
private System.Windows.Forms.RichTextBox richTextBox11;
private System.Windows.Forms.RichTextBox richTextBox12;
private System.Windows.Forms.RichTextBox richTextBox13;
private System.Windows.Forms.RichTextBox richTextBox14;
private System.Windows.Forms.RichTextBox richTextBox15;
private System.Windows.Forms.RichTextBox richTextBox16;
private System.Windows.Forms.RichTextBox richTextBox17;
private System.Windows.Forms.RichTextBox richTextBox18;
private System.Windows.Forms.RichTextBox richTextBox19;
private System.Windows.Forms.RichTextBox richTextBox20;
private System.Windows.Forms.RichTextBox richTextBox21;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.Label label27;
private System.Windows.Forms.Label label28;
private System.Windows.Forms.Label label29;
private System.Windows.Forms.Label label30;
private System.Windows.Forms.Label label31;
private System.Windows.Forms.RichTextBox richTextBox22;
private System.Windows.Forms.RichTextBox richTextBox23;
private System.Windows.Forms.RichTextBox richTextBox24;
private System.Windows.Forms.RichTextBox richTextBox25;
private System.Windows.Forms.RichTextBox richTextBox26;
private System.Windows.Forms.RichTextBox richTextBox27;
private System.Windows.Forms.RichTextBox richTextBox28;
private System.Windows.Forms.RichTextBox richTextBox29;
private System.Windows.Forms.RichTextBox richTextBox30;
private System.Windows.Forms.RichTextBox richTextBox31;
private System.Windows.Forms.Button button2;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));
this.label31 = new System.Windows.Forms.Label();
this.label30 = new System.Windows.Forms.Label();
this.richTextBox3 = new System.Windows.Forms.RichTextBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.richTextBox6 = new System.Windows.Forms.RichTextBox();
this.richTextBox7 = new System.Windows.Forms.RichTextBox();
this.richTextBox4 = new System.Windows.Forms.RichTextBox();
this.richTextBox5 = new System.Windows.Forms.RichTextBox();
this.printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog();
this.richTextBox8 = new System.Windows.Forms.RichTextBox();
this.richTextBox9 = new System.Windows.Forms.RichTextBox();
this.richTextBox31 = new System.Windows.Forms.RichTextBox();
this.richTextBox30 = new System.Windows.Forms.RichTextBox();
this.label19 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label28 = new System.Windows.Forms.Label();
this.label29 = new System.Windows.Forms.Label();
this.label26 = new System.Windows.Forms.Label();
this.label27 = new System.Windows.Forms.Label();
this.label24 = new System.Windows.Forms.Label();
this.label25 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
this.richTextBox22 = new System.Windows.Forms.RichTextBox();
this.richTextBox23 = new System.Windows.Forms.RichTextBox();
this.label15 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.richTextBox20 = new System.Windows.Forms.RichTextBox();
this.richTextBox21 = new System.Windows.Forms.RichTextBox();
this.richTextBox28 = new System.Windows.Forms.RichTextBox();
this.richTextBox29 = new System.Windows.Forms.RichTextBox();
this.richTextBox24 = new System.Windows.Forms.RichTextBox();
this.richTextBox25 = new System.Windows.Forms.RichTextBox();
this.richTextBox26 = new System.Windows.Forms.RichTextBox();
this.richTextBox27 = new System.Windows.Forms.RichTextBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.richTextBox13 = new System.Windows.Forms.RichTextBox();
this.richTextBox12 = new System.Windows.Forms.RichTextBox();
this.richTextBox11 = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.richTextBox16 = new System.Windows.Forms.RichTextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.richTextBox19 = new System.Windows.Forms.RichTextBox();
this.richTextBox18 = new System.Windows.Forms.RichTextBox();
this.richTextBox17 = new System.Windows.Forms.RichTextBox();
this.richTextBox15 = new System.Windows.Forms.RichTextBox();
this.richTextBox14 = new System.Windows.Forms.RichTextBox();
this.richTextBox10 = new System.Windows.Forms.RichTextBox();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.richTextBox2 = new System.Windows.Forms.RichTextBox();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// label31
//
this.label31.Location = new System.Drawing.Point(568, 536);
this.label31.Name = "label31";
this.label31.Size = new System.Drawing.Size(88, 32);
this.label31.TabIndex = 0;
this.label31.Text = "Auckland, Wellington";
//
// label30
//
this.label30.Location = new System.Drawing.Point(568, 480);
this.label30.Name = "label30";
this.label30.Size = new System.Drawing.Size(80, 24);
this.label30.TabIndex = 0;
this.label30.Text = "Solomon";
//
// richTextBox3
//
this.richTextBox3.Location = new System.Drawing.Point(144, 88);
this.richTextBox3.Name = "richTextBox3";
this.richTextBox3.Size = new System.Drawing.Size(104, 32);
this.richTextBox3.TabIndex = 4;
this.richTextBox3.Text = "richTextBox3";
//
// richTextBox1
//
this.richTextBox1.ForeColor = System.Drawing.Color.SaddleBrown;
this.richTextBox1.Location = new System.Drawing.Point(152, 48);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(112, 32);
this.richTextBox1.TabIndex = 4;
this.richTextBox1.Text = "2/2/2002 6:00:00 AM";
//
// richTextBox6
//
this.richTextBox6.Location = new System.Drawing.Point(144, 424);
this.richTextBox6.Name = "richTextBox6";
this.richTextBox6.Size = new System.Drawing.Size(104, 32);
this.richTextBox6.TabIndex = 2;
this.richTextBox6.Text = "richTextBox6";
//
// richTextBox7
//
this.richTextBox7.Location = new System.Drawing.Point(144, 256);
this.richTextBox7.Name = "richTextBox7";
this.richTextBox7.Size = new System.Drawing.Size(104, 32);
this.richTextBox7.TabIndex = 2;
this.richTextBox7.Text = "richTextBox7";
//
// richTextBox4
//
this.richTextBox4.Location = new System.Drawing.Point(144, 312);
this.richTextBox4.Name = "richTextBox4";
this.richTextBox4.Size = new System.Drawing.Size(104, 32);
this.richTextBox4.TabIndex = 2;
this.richTextBox4.Text = "richTextBox4";
//
// richTextBox5
//
this.richTextBox5.Location = new System.Drawing.Point(144, 368);
this.richTextBox5.Name = "richTextBox5";
this.richTextBox5.Size = new System.Drawing.Size(104, 32);
this.richTextBox5.TabIndex = 2;
this.richTextBox5.Text = "richTextBox5";
//
// printPreviewDialog1
//
this.printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.ClientSize = new System.Drawing.Size(400, 300);
this.printPreviewDialog1.Enabled = true;
this.printPreviewDialog1.Icon =
((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
this.printPreviewDialog1.Location = new System.Drawing.Point(176, 176);
this.printPreviewDialog1.MaximumSize = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.Name = "printPreviewDialog1";
this.printPreviewDialog1.Opacity = 1;
this.printPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty;
this.printPreviewDialog1.Visible = false;
//
// richTextBox8
//
this.richTextBox8.Location = new System.Drawing.Point(144, 200);
this.richTextBox8.Name = "richTextBox8";
this.richTextBox8.Size = new System.Drawing.Size(104, 32);
this.richTextBox8.TabIndex = 2;
this.richTextBox8.Text = "richTextBox8";
//
// richTextBox9
//
this.richTextBox9.Location = new System.Drawing.Point(144, 144);
this.richTextBox9.Name = "richTextBox9";
this.richTextBox9.Size = new System.Drawing.Size(104, 32);
this.richTextBox9.TabIndex = 2;
this.richTextBox9.Text = "richTextBox9";
//
// richTextBox31
//
this.richTextBox31.Location = new System.Drawing.Point(688, 536);
this.richTextBox31.Name = "richTextBox31";
this.richTextBox31.Size = new System.Drawing.Size(104, 32);
this.richTextBox31.TabIndex = 2;
this.richTextBox31.Text = "richTextBox31";
//
// richTextBox30
//
this.richTextBox30.Location = new System.Drawing.Point(688, 480);
this.richTextBox30.Name = "richTextBox30";
this.richTextBox30.Size = new System.Drawing.Size(104, 32);
this.richTextBox30.TabIndex = 2;
this.richTextBox30.Text = "richTextBox30";
//
// label19
//
this.label19.Location = new System.Drawing.Point(296, 488);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(88, 32);
this.label19.TabIndex = 0;
this.label19.Text = "Islamabad, Karachi";
//
// label20
//
this.label20.Location = new System.Drawing.Point(288, 536);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(112, 40);
this.label20.TabIndex = 0;
this.label20.Text = "Calcutta, Chennai, Mumbai, NewDelhi";
//
// label28
//
this.label28.Location = new System.Drawing.Point(568, 368);
this.label28.Name = "label28";
this.label28.Size = new System.Drawing.Size(88, 32);
this.label28.TabIndex = 0;
this.label28.Text = "Darwin";
//
// label29
//
this.label29.Location = new System.Drawing.Point(568, 424);
this.label29.Name = "label29";
this.label29.Size = new System.Drawing.Size(120, 40);
this.label29.TabIndex = 0;
this.label29.Text = "Brisbane, Canbera, Melbourne,Sydney";
//
// label26
//
this.label26.Location = new System.Drawing.Point(568, 256);
this.label26.Name = "label26";
this.label26.Size = new System.Drawing.Size(104, 40);
this.label26.TabIndex = 0;
this.label26.Text = "HonKong, Singapore, Perth";
//
// label27
//
this.label27.Location = new System.Drawing.Point(568, 312);
this.label27.Name = "label27";
this.label27.Size = new System.Drawing.Size(88, 32);
this.label27.TabIndex = 0;
this.label27.Text = "Tokyo , Seoul";
//
// label24
//
this.label24.Location = new System.Drawing.Point(568, 144);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(88, 32);
this.label24.TabIndex = 0;
this.label24.Text = "Rangoon";
//
// label25
//
this.label25.Location = new System.Drawing.Point(568, 200);
this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(88, 32);
this.label25.TabIndex = 0;
this.label25.Text = "Bangkok";
//
// label22
//
this.label22.Location = new System.Drawing.Point(16, 488);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(96, 24);
this.label22.TabIndex = 0;
this.label22.Text = "New Foundland";
//
// label23
//
this.label23.Location = new System.Drawing.Point(568, 88);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(88, 32);
this.label23.TabIndex = 0;
this.label23.Text = "Daka";
//
// label21
//
this.label21.Location = new System.Drawing.Point(16, 544);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(88, 32);
this.label21.TabIndex = 0;
this.label21.Text = "Brasilia, GreenLand";
//
// label18
//
this.label18.Location = new System.Drawing.Point(568, 32);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(88, 32);
this.label18.TabIndex = 0;
this.label18.Text = "Katmandu";
//
// richTextBox22
//
this.richTextBox22.Location = new System.Drawing.Point(688, 32);
this.richTextBox22.Name = "richTextBox22";
this.richTextBox22.Size = new System.Drawing.Size(104, 32);
this.richTextBox22.TabIndex = 2;
this.richTextBox22.Text = "richTextBox22";
//
// richTextBox23
//
this.richTextBox23.Location = new System.Drawing.Point(688, 88);
this.richTextBox23.Name = "richTextBox23";
this.richTextBox23.Size = new System.Drawing.Size(104, 32);
this.richTextBox23.TabIndex = 2;
this.richTextBox23.Text = "richTextBox23";
//
// label15
//
this.label15.Location = new System.Drawing.Point(296, 376);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(88, 32);
this.label15.TabIndex = 0;
this.label15.Text = "Tehran";
//
// label14
//
this.label14.Location = new System.Drawing.Point(296, 200);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(120, 40);
this.label14.TabIndex = 0;
this.label14.Text = "Amsterdam, Berlin, Rome ,Paris, W.C.Africa";
//
// label17
//
this.label17.Location = new System.Drawing.Point(296, 32);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(88, 32);
this.label17.TabIndex = 0;
this.label17.Text = "MidAtlantic";
//
// label16
//
this.label16.Location = new System.Drawing.Point(296, 88);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(88, 32);
this.label16.TabIndex = 0;
this.label16.Text = "Azores, Cape verdeis";
//
// label11
//
this.label11.Location = new System.Drawing.Point(296, 256);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(104, 32);
this.label11.TabIndex = 0;
this.label11.Text = "Athens, Istanbul, Cairo, Jerusalem";
//
// label10
//
this.label10.Location = new System.Drawing.Point(296, 432);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(88, 32);
this.label10.TabIndex = 0;
this.label10.Text = "Abu Dhabi, Muscat,Kabul";
//
// label13
//
this.label13.Location = new System.Drawing.Point(296, 320);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(104, 32);
this.label13.TabIndex = 0;
this.label13.Text = "Baghdad, Kuwait, Moscow";
//
// label12
//
this.label12.Location = new System.Drawing.Point(296, 144);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(96, 32);
this.label12.TabIndex = 0;
this.label12.Text = "London, Lisbon, Dublin";
//
// richTextBox20
//
this.richTextBox20.Location = new System.Drawing.Point(416, 480);
this.richTextBox20.Name = "richTextBox20";
this.richTextBox20.Size = new System.Drawing.Size(104, 32);
this.richTextBox20.TabIndex = 2;
this.richTextBox20.Text = "richTextBox20";
//
// richTextBox21
//
this.richTextBox21.Location = new System.Drawing.Point(416, 536);
this.richTextBox21.Name = "richTextBox21";
this.richTextBox21.Size = new System.Drawing.Size(104, 32);
this.richTextBox21.TabIndex = 2;
this.richTextBox21.Text = "richTextBox21";
//
// richTextBox28
//
this.richTextBox28.Location = new System.Drawing.Point(688, 368);
this.richTextBox28.Name = "richTextBox28";
this.richTextBox28.Size = new System.Drawing.Size(104, 32);
this.richTextBox28.TabIndex = 2;
this.richTextBox28.Text = "richTextBox28";
//
// richTextBox29
//
this.richTextBox29.Location = new System.Drawing.Point(688, 424);
this.richTextBox29.Name = "richTextBox29";
this.richTextBox29.Size = new System.Drawing.Size(104, 32);
this.richTextBox29.TabIndex = 2;
this.richTextBox29.Text = "richTextBox29";
//
// richTextBox24
//
this.richTextBox24.Location = new System.Drawing.Point(688, 144);
this.richTextBox24.Name = "richTextBox24";
this.richTextBox24.Size = new System.Drawing.Size(104, 32);
this.richTextBox24.TabIndex = 2;
this.richTextBox24.Text = "richTextBox24";
//
// richTextBox25
//
this.richTextBox25.Location = new System.Drawing.Point(688, 200);
this.richTextBox25.Name = "richTextBox25";
this.richTextBox25.Size = new System.Drawing.Size(104, 32);
this.richTextBox25.TabIndex = 2;
this.richTextBox25.Text = "richTextBox25";
//
// richTextBox26
//
this.richTextBox26.Location = new System.Drawing.Point(688, 256);
this.richTextBox26.Name = "richTextBox26";
this.richTextBox26.Size = new System.Drawing.Size(104, 32);
this.richTextBox26.TabIndex = 2;
this.richTextBox26.Text = "richTextBox26";
//
// richTextBox27
//
this.richTextBox27.Location = new System.Drawing.Point(688, 312);
this.richTextBox27.Name = "richTextBox27";
this.richTextBox27.Size = new System.Drawing.Size(104, 32);
this.richTextBox27.TabIndex = 2;
this.richTextBox27.Text = "richTextBox27";
//
// label4
//
this.label4.Location = new System.Drawing.Point(24, 144);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(88, 32);
this.label4.TabIndex = 5;
this.label4.Text = "Alaska";
//
// label5
//
this.label5.Location = new System.Drawing.Point(24, 200);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(88, 32);
this.label5.TabIndex = 5;
this.label5.Text = "Pacific time";
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 432);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(104, 48);
this.label6.TabIndex = 5;
this.label6.Text = "Atlantic Time(canada), Santiago";
//
// label7
//
this.label7.Location = new System.Drawing.Point(24, 320);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(104, 32);
this.label7.TabIndex = 5;
this.label7.Text = "Central America , Mexico City";
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.label1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)),
((System.Byte)(192)), ((System.Byte)(0)));
this.label1.Location = new System.Drawing.Point(32, 48);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(96, 32);
this.label1.TabIndex = 0;
this.label1.Text = "Enter US Central Timing";
//
// label2
//
this.label2.Location = new System.Drawing.Point(24, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(88, 32);
this.label2.TabIndex = 0;
this.label2.Text = "Midway Island, Samoa";
//
// label3
//
this.label3.Location = new System.Drawing.Point(24, 88);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 32);
this.label3.TabIndex = 3;
this.label3.Text = "Hawaii";
//
// richTextBox13
//
this.richTextBox13.Location = new System.Drawing.Point(416, 88);
this.richTextBox13.Name = "richTextBox13";
this.richTextBox13.Size = new System.Drawing.Size(104, 32);
this.richTextBox13.TabIndex = 2;
this.richTextBox13.Text = "richTextBox13";
//
// richTextBox12
//
this.richTextBox12.Location = new System.Drawing.Point(416, 32);
this.richTextBox12.Name = "richTextBox12";
this.richTextBox12.Size = new System.Drawing.Size(104, 32);
this.richTextBox12.TabIndex = 2;
this.richTextBox12.Text = "richTextBox12";
//
// richTextBox11
//
this.richTextBox11.Location = new System.Drawing.Point(144, 536);
this.richTextBox11.Name = "richTextBox11";
this.richTextBox11.Size = new System.Drawing.Size(104, 32);
this.richTextBox11.TabIndex = 2;
this.richTextBox11.Text = "richTextBox11";
//
// button1
//
this.button1.BackColor = System.Drawing.Color.Gray;
this.button1.Location = new System.Drawing.Point(376, 48);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(128, 32);
this.button1.TabIndex = 2;
this.button1.Text = "getTime";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// richTextBox16
//
this.richTextBox16.Location = new System.Drawing.Point(416, 256);
this.richTextBox16.Name = "richTextBox16";
this.richTextBox16.Size = new System.Drawing.Size(104, 32);
this.richTextBox16.TabIndex = 2;
this.richTextBox16.Text = "richTextBox16";
//
// groupBox1
//
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.richTextBox31,
this.richTextBox30,
this.richTextBox29,
this.richTextBox28,
this.richTextBox27,
this.richTextBox26,
this.richTextBox25,
this.richTextBox24,
this.richTextBox23,
this.richTextBox22,
this.label31,
this.label30,
this.label29,
this.label28,
this.label27,
this.label26,
this.label25,
this.label24,
this.label23,
this.label18,
this.richTextBox21,
this.richTextBox20,
this.richTextBox19,
this.richTextBox18,
this.richTextBox17,
this.richTextBox16,
this.richTextBox15,
this.richTextBox14,
this.richTextBox13,
this.richTextBox12,
this.richTextBox11,
this.richTextBox10,
this.label22,
this.label21,
this.label20,
this.label19,
this.label17,
this.label16,
this.label15,
this.label14,
this.label13,
this.label12,
this.label11,
this.label10,
this.richTextBox9,
this.richTextBox8,
this.richTextBox7,
this.richTextBox6,
this.richTextBox5,
this.richTextBox4,
this.label9,
this.label8,
this.label7,
this.label6,
this.label5,
this.label4,
this.richTextBox3,
this.label3,
this.richTextBox2,
this.label2});
this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif",
8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.groupBox1.ForeColor = System.Drawing.Color.LimeGreen;
this.groupBox1.Location = new System.Drawing.Point(8, 104);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(808, 624);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "correspondingWorldTimings";
//
// richTextBox19
//
this.richTextBox19.Location = new System.Drawing.Point(416, 424);
this.richTextBox19.Name = "richTextBox19";
this.richTextBox19.Size = new System.Drawing.Size(104, 32);
this.richTextBox19.TabIndex = 2;
this.richTextBox19.Text = "richTextBox19";
//
// richTextBox18
//
this.richTextBox18.Location = new System.Drawing.Point(416, 368);
this.richTextBox18.Name = "richTextBox18";
this.richTextBox18.Size = new System.Drawing.Size(104, 32);
this.richTextBox18.TabIndex = 2;
this.richTextBox18.Text = "richTextBox18";
//
// richTextBox17
//
this.richTextBox17.Location = new System.Drawing.Point(416, 312);
this.richTextBox17.Name = "richTextBox17";
this.richTextBox17.Size = new System.Drawing.Size(104, 32);
this.richTextBox17.TabIndex = 2;
this.richTextBox17.Text = "richTextBox17";
//
// richTextBox15
//
this.richTextBox15.Location = new System.Drawing.Point(416, 200);
this.richTextBox15.Name = "richTextBox15";
this.richTextBox15.Size = new System.Drawing.Size(104, 32);
this.richTextBox15.TabIndex = 2;
this.richTextBox15.Text = "richTextBox15";
//
// richTextBox14
//
this.richTextBox14.Location = new System.Drawing.Point(416, 144);
this.richTextBox14.Name = "richTextBox14";
this.richTextBox14.Size = new System.Drawing.Size(104, 32);
this.richTextBox14.TabIndex = 2;
this.richTextBox14.Text = "richTextBox14";
//
// richTextBox10
//
this.richTextBox10.Location = new System.Drawing.Point(144, 480);
this.richTextBox10.Name = "richTextBox10";
this.richTextBox10.Size = new System.Drawing.Size(104, 32);
this.richTextBox10.TabIndex = 2;
this.richTextBox10.Text = "richTextBox10";
//
// label9
//
this.label9.Location = new System.Drawing.Point(24, 376);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(120, 32);
this.label9.TabIndex = 5;
this.label9.Text = "US Eastern Time, Lima,Quito,Indiana";
//
// label8
//
this.label8.Location = new System.Drawing.Point(24, 256);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(96, 32);
this.label8.TabIndex = 5;
this.label8.Text = "Arizona, Mountain time";
//
// richTextBox2
//
this.richTextBox2.ForeColor = System.Drawing.SystemColors.Highlight;
this.richTextBox2.Location = new System.Drawing.Point(144, 32);
this.richTextBox2.Name = "richTextBox2";
this.richTextBox2.Size = new System.Drawing.Size(104, 32);
this.richTextBox2.TabIndex = 2;
this.richTextBox2.Text = "richTextBox2";
//
// button2
//
this.button2.BackColor = System.Drawing.Color.Gray;
this.button2.Location = new System.Drawing.Point(568, 48);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(120, 32);
this.button2.TabIndex = 5;
this.button2.Text = "&Exit";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.IndianRed;
this.ClientSize = new System.Drawing.Size(824, 753);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.richTextBox1,
this.groupBox1,
this.button1,
this.label1,
this.button2});
this.ForeColor = System.Drawing.Color.Black;
this.Name = "Form1";
this.Text = "World Timings";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
// converting the text in richTextBox1 into DateTime
DateTime dt = Convert.ToDateTime(richTextBox1.Text);
//Ist Line:Adding/Subtracting the corresponding hours for each
//time zone relative to US Central timing
// 2nd line: Converting date to String back again
//3rd Line : Displaying that to textBox again
DateTime str = dt.AddHours(-5.0);
string str2 = str.ToString();
richTextBox2.Text = str2;
DateTime str3 = dt.AddHours(-4.0);
string str4 = str3.ToString();
richTextBox3.Text = str4;
DateTime str5 = dt.AddHours(-3.0);
string str6 = str5.ToString();
richTextBox9.Text = str6;
DateTime str7 = dt.AddHours(-2.0);
string str8 = str7.ToString();
richTextBox8.Text = str8;
DateTime str9 = dt.AddHours(-1.0);
string str10 = str9.ToString();
richTextBox7.Text = str10;
DateTime str11 = dt.AddHours(0.0);
string str12 = str11.ToString();
richTextBox4.Text = str12;
DateTime str13 = dt.AddHours(1.0);
string str14 = str13.ToString();
richTextBox5.Text = str14;
DateTime str15 = dt.AddHours(2.0);
string str16 = str15.ToString();
richTextBox6.Text = str16;
DateTime str17 = dt.AddHours(2.5);
string str18 = str17.ToString();
richTextBox10.Text = str18;
DateTime str19 = dt.AddHours(3.0);
string str20 = str19.ToString();
richTextBox11.Text = str20;
DateTime str21 = dt.AddHours(4.0);
string str22 = str21.ToString();
richTextBox12.Text = str22;
DateTime str23 = dt.AddHours(5.0);
string str24 = str23.ToString();
richTextBox13.Text = str24;
DateTime str25 = dt.AddHours(6.0);
string str26 = str25.ToString();
richTextBox14.Text = str26;
DateTime str27 = dt.AddHours(7.0);
string str28 = str27.ToString();
richTextBox15.Text = str28;
DateTime str29 = dt.AddHours(8.0);
string str30 = str29.ToString();
richTextBox16.Text = str30;
DateTime str31 = dt.AddHours(9.0);
string str32 = str31.ToString();
richTextBox17.Text = str32;
DateTime str33 = dt.AddHours(9.5);
string str34 = str33.ToString();
richTextBox18.Text = str34;
DateTime str35 = dt.AddHours(10.0);
string str36 = str35.ToString();
richTextBox19.Text = str36;
DateTime str37 = dt.AddHours(11.0);
string str38 = str37.ToString();
richTextBox20.Text = str38;
DateTime str39 = dt.AddHours(11.5);
string str40 = str39.ToString();
richTextBox21.Text = str40;
DateTime str41 = dt.AddHours(11.75);
string str42 = str41.ToString();
richTextBox22.Text = str42;
DateTime str43 = dt.AddHours(12.0);
string str44 = str43.ToString();
richTextBox23.Text = str44;
DateTime str45 = dt.AddHours(12.50);
string str46 = str45.ToString();
richTextBox24.Text = str46;
DateTime str47 = dt.AddHours(13.0);
string str48 = str47.ToString();
richTextBox25.Text = str48;
DateTime str49 = dt.AddHours(14.0);
string str50 = str49.ToString();
richTextBox26.Text = str50;
DateTime str51 = dt.AddHours(15.0);
string str52 = str51.ToString();
richTextBox27.Text = str52;
DateTime str53 = dt.AddHours(15.5);
string str54 = str53.ToString();
richTextBox28.Text = str54;
DateTime str55 = dt.AddHours(16.0);
string str56 = str55.ToString();
richTextBox29.Text = str56;
DateTime str57 = dt.AddHours(17.0);
string str58 = str57.ToString();
richTextBox30.Text = str58;
DateTime str59 = dt.AddHours(18.0);
string str60 = str59.ToString();
richTextBox31.Text = str60;
}
//button2 : to Exit the Apllication.
private void button2_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
}
}
// end of code
|