Why Is My App Showing the Wrong Time? How to Handle Time Zones.
You built an app with Claude, ChatGPT, Bolt, or Lovable that stores or displays times and dates. A user in London creates an event at 3pm. A user in New York…
You built an app with Claude, ChatGPT, Bolt, or Lovable that stores or displays times and dates. A user in London creates an event at 3pm. A user in New York sees it at 3pm too, but that is the wrong time for them. Or your app sends an email saying “your appointment is at 10am” but the user is in a different time zone and 10am means something completely different. Time zones are one of the most common sources of bugs in apps built by non-technical founders, and they have a specific, learnable solution.
Why Time Zones Are Tricky
Your server runs in one time zone, typically UTC (Coordinated Universal Time), the standard reference time zone. Your users are in different time zones around the world. When you store a time without recording which time zone it belongs to, you lose critical information and chaos follows.
A one-sentence definition: time zone handling means storing all times as UTC in your database and converting to the user’s local time only when displaying.
The golden rule of time zones: store UTC, display local.
The Two Common Mistakes
Storing times in local time. If you store “10:00 AM” without recording that it is London time, you have no way to accurately convert it for a user in Tokyo. Always store times as UTC.
Not knowing the user’s time zone. To display a time correctly for a specific user, you need to know where they are. This comes from either asking them (a time zone setting in their profile) or detecting it automatically from their browser.
Storing Times Correctly
In your database, always store dates and times as UTC. Most databases have a TIMESTAMP WITH TIME ZONE or TIMESTAMPTZ type that handles this correctly. Supabase and PostgreSQL use TIMESTAMPTZ. Avoid plain TIMESTAMP which does not store time zone information.
Ask your AI: “Can you check how my app is storing dates and times in the database? Make sure all date and time fields use UTC and the appropriate timezone-aware column type.”
Converting Times for Display
When showing a time to a user, convert from UTC to their local time zone.
In JavaScript (frontend): the built-in Intl.DateTimeFormat API handles time zone conversion automatically using the user’s browser time zone.
javascript
const date = new Date('2026-06-15T10:00:00Z'); // UTC time
const formatted = new Intl.DateTimeFormat('en-GB', {
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
dateStyle: 'full',
timeStyle: 'short'
}).format(date);
This detects the user’s browser time zone automatically and formats the time correctly for them.
In Python (backend): use the pytz or zoneinfo library to convert between time zones.
Ask your AI: “My app displays dates and times to users. Can you update the date display code to show times in the user’s local time zone rather than UTC? Detect the time zone from the browser automatically.”
Handling Scheduled Events
If your app lets users schedule things, like appointments, recurring events, or reminders, time zones become more complex. A 9am Monday appointment means 9am in the user’s time zone, not 9am UTC.
The approach: store the UTC equivalent of the scheduled time AND store the original time zone the user was in when they created it. When displaying, show the time in the user’s current time zone. When calculating when to send a reminder, use the UTC version.
Ask your AI: “My app lets users schedule events. Can you update the scheduling logic to store events as UTC with the original time zone recorded, and display them correctly in each user’s local time?”
The One Thing to Remember
Store all times as UTC in your database. Display times in the user’s local time zone by converting at display time. In JavaScript, Intl.DateTimeFormat detects the user’s time zone automatically. In Python, use pytz or zoneinfo. The golden rule: store UTC, display local. Every time zone bug traces back to someone forgetting one of these two things.
Want your app handling time-sensitive data reliably? → Snapdock
New here? These might help: What is a database? And does my app actually need one? → What is a cron job? The simplest explanation you will find. →