What is UTC and time zones?

UTC is one world clock. Save times in it, then convert to each person's local time only when showing them.

Where UTC and time zones goes wrong in real apps

Each of these is a short scenario built from a real failure in an app made with AI. Read the answer here, or walk through it yourself in about four minutes.

  • The life of a click · 4 minutes · Pro

    4am for a 10am booking

    A customer in Chicago books a 10am appointment. Your confirmation email says 4am. The calendar page says 10am.

    Why does my app show the wrong time?

    The time was probably stored without a time zone, so the server and the browser each guess one. Store moments as timestamptz in Postgres (an exact moment, kept as UTC), store each user's time zone separately, and convert to local time only when displaying, using the same rule on server and browser.

    Read the fix
Server
A computer that runs your app's code out of sight. Users can't change what happens there, which is why checks belong there.
Browser
Chrome, Safari and friends. Everything that runs here is visible to, and changeable by, the person using it.
Database
Where your app keeps its data, organised in tables, like a set of spreadsheets.
Table, row, column
A table is like one spreadsheet (orders). Each row is one item (one order); each column is one detail (price, date).

All 62 terms in the glossary

Before you go

Get the next trail by email

Five short lessons on what breaks in apps built with AI and how to check yours, then one email each time a new trail ships. Unsubscribe in one click.