Why Time zones are important to software engineers

Hansini Rupasinghe
2 min readMay 5, 2021

--

A time zone is simply a function which gives an offset for a particular date. This is affected by the time zone definition and the time rules of daylight savings of the specific date. If the region in which the time needs to be calculated is located to the left of the prime meridian, it is determined after subtracting the offset from UTC. Similarly, the time zones in the right to the prime meridian is determined after adding the offset to UTC.

[Ref: “List of UTC time offsets — Wikipedia”, En.wikipedia.org.[Online].Available: https://en.wikipedia.org/wiki/List_of_UTC_time_offsets#/media/File:World_Time_Zones_Map.png]

UTC — Universal Time Coordinated

UTC, which stands for Coordinated Universal Time is the time standard used by the whole wide world. The local time of any place around the world can be calculated by either adding or subtracting an offset from UTC. The time that is in the territory of the world where the longitude equals to 0 degrees (Prime Meridian) is the UTC. This is also called GMT. (Greenwich Mean Time)

🟢 Main Difference between GMT and UTC that a developer must know — UTC does not observe Daylight Saving Time

DST — Daylight Saving Time

DST, which stands for Daylight Saving Time is an act of adjusting the clocks one hour ahead when compared to standard time during summer with the purpose of saving natural light.

The time zone is changed at the time when a territory onsets daylight saving in order to reflect this.

Standard Time

Standard time is used to determine time zones. When Daylight Saving Time is not used, this time will be using in a territory.

✨ Important: Daylight Saving will not be used by each and every territory that use the same standard time and time zone.

Java Dates

Although Java does not contain any built-in Date class, java.time package along with many date and time classes can be imported.

[Ref: “Java Date and Time”, W3schools.com.[Online].Available: https://www.w3schools.com/java/java_date.asp]

Facts to Remember when developing software!

🔴 Time zone of your server must be set to UTC.

🔴 Avoid using timestamps to store future or past.

🔴 When filling metadata such as created, edited, posted etc., use the Server’s time.

🔴 Datetime must be stored in UTC time zone.

🔴 Convert time to local time zone in the application layer and at the same time, show datetime to users.

--

--

No responses yet