World Clock : Visual C#

By | February 28, 2016

  World Clock is one of our best programs till date. It shows you the current time in various time zones of the world. It also tells you which cities/places are located under those time zones. The list of cities is not exhaustive (it isn’t possible to do so), but we have included all those cities/places which are the most prominent ones in a particular time zone. Usually, these places happen to be the capital city of a country or other large cities of a country.

Please Note that some time zones of the world implement Daylight Saving. In case of those time zones, the time displayed by this program might not be accurate (depending upon the date). Therefore, you may need to add an hour (or more, depending upon the time zone) to the time displayed by this program. For other time zones, this program is perfectly accurate. The UTC time zone does not implement Daylight Saving. Read more about Daylight Saving Time here.

World Clock

  The World Clock, as explained above, displays the current time in the various time zones of the world. It works by first getting the value of the UTC date and time, after which it adds or subtracts time to calculate the current date and time in other time zones (depending upon whether they are ahead of UTC or behind UTC).

For example, Indian Standard Time (IST) is 5 hours and 30 minutes ahead of UTC. It is displayed as UTC + 5:30 in this program. The time for IST is calculated by adding 5 hours and 30 minutes to the UTC time. More precisely, we add ticks (1 tick = 10-7 seconds). The following paragraph explains how this is done.

  The Windows API considers time to have a base value of 01/01/0001 00:00 i.e. the midnight of January 1, Year 1. Any time after that is calculated by adding ticks, where 1 tick = 100 nanosecond (or, 10-7 second). According to this method, there are 107 ticks per second, 6*108 ticks per minute and 3.6 * 1010 ticks per hour. Therefore, if we need to add /subtract 1 hour to UTC time, we add/subtract 3.6*1010 ticks to/from it. To add/subtract time other than 1 hour, we add/subtract multiples of 3.6*1010 ticks.

World Clock – UI

  The UI of World Clock is pretty simple. The top of the window displays UTC date and time on the left side and your local date and time on the right side. Below these, there are two columns. The first column displays the time zones to the west of UTC and the second one displays the time zones to the right of UTC. Below these, your current time zone is displayed. At the bottom of the window, there is a status bar which shows you the cities/places which are located at a particular time zone. To view the cities/places located at a time zone, hover the mouse pointer over it. The screenshot below displays the UI of World Clock.

World Clock

World Clock

Download World Clock

  You can download the following files pertaining to this project :
World Clock Source Code (130 KB)
World Clock Executable (39 KB). This program requires .NET Framework 4.5
  If you like this project, don’t forget to SHARE IT. If you have any suggestions queries concerning the World Clock program, do let us know.

(Visited 679 times, 1 visits today)

One thought on “World Clock : Visual C#

  1. Nordic Nerd

    I love your blog a lot. It has helped me learn a lot.


Leave a Reply

Your email address will not be published. Required fields are marked *