MySQL
timezone
UTC
database management
server configuration

Should MySQL have its timezone set to UTC?

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

For most applications, setting MySQL and the surrounding server environment to UTC is the safest default. UTC avoids daylight-saving ambiguity, keeps logs and database timestamps consistent across machines, and makes cross-region systems easier to reason about. The important nuance is that UTC is usually the storage and infrastructure timezone, while user-facing local time should be handled in the application or presentation layer.

Why UTC Is Usually the Best Default

UTC does not shift for daylight saving time, which removes a whole category of operational bugs. If your database stores times in local time, you eventually run into questions like:

  • which of the two repeated 01:30 timestamps during fall-back did this row mean
  • what should happen to nonexistent times during spring-forward
  • how do services in different regions compare timestamps reliably

Storing in UTC keeps the timeline continuous and unambiguous.

Infrastructure Consistency Matters More Than Local Convenience

Databases rarely live in isolation. They interact with:

  • application servers
  • job schedulers
  • background workers
  • logs
  • monitoring systems

When those systems all use UTC, cross-system debugging gets much simpler. A timestamp in a log line and a timestamp in a database row refer to the same absolute point in time without mental conversion.

That is one of the strongest arguments for UTC even in applications used by only one local region.

MySQL Timezone Settings and Column Types

Timezone policy is not just a server setting question. It also depends on the column type.

TIMESTAMP values are stored in UTC internally and converted according to the session timezone on input and output. DATETIME values are stored as literal date-time values with no timezone conversion.

That means the meaning of a stored value depends on both:

  • the column type
  • the timezone expectations of the application

If you want absolute instants, UTC plus careful handling of TIMESTAMP or UTC-normalized DATETIME values is the common pattern.

A Practical UTC Setup

A typical operational policy is:

  • server OS uses UTC
  • MySQL global timezone is UTC
  • application connections use UTC
  • user-local formatting happens outside the database

At the SQL level, you can inspect timezone settings like this:

sql
SELECT @@global.time_zone, @@session.time_zone;

And you can set the session timezone explicitly:

sql
SET time_zone = '+00:00';

Being explicit at the connection level is useful because it removes doubt about what the session is doing.

Convert for Users at the Edge

UTC storage does not mean users should see UTC. It means UTC is the canonical stored representation.

For example, an application might store:

sql
2026-03-11 15:00:00 UTC

and then display it as:

  • '10:00 AM in Toronto during standard time'
  • '4:00 PM in London'
  • '12:00 AM in Tokyo the next day'

That conversion belongs in the application or client layer, where you actually know the user's timezone and daylight-saving rules.

When Local Time Storage Can Still Be Legitimate

Not every date-time value is an absolute instant. Some business concepts are inherently local, such as:

  • a store opening at 09:00 every day in a specific city
  • a legal deadline defined by local civil time
  • a recurring schedule attached to one timezone by rule

In those cases, blindly converting everything to UTC can lose the intent of the data model. A good design may store:

  • the UTC instant for audit and event timing
  • plus the original local timezone or local business time when that matters

So the best rule is not “UTC for everything with no thought.” It is “UTC for absolute instants by default, with local-time modeling only when the domain truly requires it.”

Common Pitfalls

The first pitfall is storing local times in the database and only later trying to reconstruct what timezone they meant. If the timezone is not part of the data contract, the meaning becomes ambiguous.

Another issue is mixing UTC and local time across services. Even if each component works on its own, cross-system debugging becomes painful.

Developers also confuse MySQL TIMESTAMP and DATETIME. They do not behave the same way with respect to timezone conversion.

Finally, using UTC storage does not remove the need to model user-local time correctly at display time. It only makes the stored timeline reliable.

Summary

  • For most systems, MySQL should use UTC as its default server and session timezone.
  • UTC avoids daylight-saving ambiguity and makes distributed systems easier to debug.
  • 'TIMESTAMP and DATETIME do not have the same timezone behavior, so choose intentionally.'
  • Convert to local time in the application or presentation layer, not in the storage model by default.
  • Keep local civil-time values only when the business meaning genuinely depends on local timezone rules.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.