Downloads:
Features:
- Live clock with 12 & 24 clock formats
C# Source Code:
- Main.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
using System; using System.Windows.Forms; namespace Digital_Clock { public partial class Main : Form { public Main() { InitializeComponent(); } private void Main_Load(object sender, EventArgs e) { timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { int hh = DateTime.Now.Hour; // 24 Hours System int mm = DateTime.Now.Minute; int ss = DateTime.Now.Second; int smallhour = (hh > 12) ? hh - 12 : hh; // 12 Hours System string time = ""; string times = ""; if (hh < 10) { time += "0" + hh; times += "0" + smallhour; } else { time += hh; times += smallhour; } time += ":"; times += ":"; if (mm < 10) { time += "0" + mm; times += "0" + mm; } else { time += mm; times += mm; } time += ":"; times += ":"; if (ss < 10) { time += "0" + ss; times += "0" + ss; } else { time += ss; times += ss; } label1.Text = time; if (hh >= 12) { label3.Text = "PM"; } else if (hh < 12) { label3.Text = "AM"; } label2.Text = times; } } } |
Screenshots:
Similar Apps:
Unknown
Contact: