You’re Doing It Wrong: Stop Making a Mess Out of Your App’s Time Zones With UTC

At Inverted Software we craft dozens of apps and APIs per year for our customers.

One of the many challenges every client / server system face is the synchronization of time.

Apps might be using multiple micro services and databases in different clouds and mobile apps might be running on different devices anywhere in the world.

How can all those systems coordinate times and subsequently show the correct time to the user regardless of the time zone they currently reside in?

Coordinated Universal Time or UTC for short is the primary time standard by which the world regulates clocks and time.

Every system has a Single Source of Truth (SSOT). This could be the SQL database where your users are stored or the NoSQL Data Wearhouse that encapsulates your transactions.

Data stored in your system should only store dates and times as UTC and the User Interface (UI) should translate UTC Dates to local time via local time zone translation.

Your UI can be your web or mobile application and always has the ability to read the local time zone from the device it is running on.

In fact, there are JavaScript libraries such as Moment.js that help you do just that, read and convert times, regardless of the type of device you are running on.

UTC is within about 1 second of mean solar time at 0° longitude and is not adjusted for daylight saving time so it never changes when daylight savings occurs, allowing you to calculate local dates backwards and forwards depending on the time of year.

This means your systems will never go out of sync and transaction dates will stay accurate.

UTC-Time

Stop adding local times to your database. Time zones change. UTC stays constant.

Store only UTC times in your database and let your web or mobile app handle the time zone conversion.

Need an evaluation of your systems?
Contact us at:
Phone: 818.262.8552
Email: Contact@InvertedSoftware.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s