UTC may not be your choice

Chao Yang
1 min readJan 15, 2021

We’ll always need time for at least one field when we deal with data in a database. But is UTC always be your choice with no doubt?

Generally speaking, UTC is what we use to make sure accuracy no matter how timezone changes. But have you ever think about your actual requirement? Do you need an absolute time or a relative time?

For example, you are building a system that gives orders to drivers and tracks trucks' delivery time. From a technical point of view, yes, we want to show local time to users, so need UTC and timezone for conversion. So the delivery time could be 6 am or 7 am when DST comes. But, for a local store that is waiting for the delivery, is it expecting the change? Most likely, no. In this case, the local store just needs the delivery to be 6 am no matter how timezone offset changes. Now, we need the time to be an absolute time. Do you still think UTC+offset is a good combination to show local time to users?

So please do a full analysis and design before choose to use UTC in the database.

--

--