---
title: "Why I Only Use UTC and Why You Should Too"
description: "Learn why storing timestamps in UTC and only converting to local time zones at display time prevents costly DST bugs, scheduling errors, and logging chaos in backend systems. Includes practical Django examples for timezone handling, deployment tagging, and user preference management."
image: "https://cdn.sethserver.com/blog-images/why-i-only-use-utc-and-why-you-should-too-social-1794887396.jpg"
---

# Why I Only Use UTC and Why You Should Too

Let's acknowledge the obvious: yes, this is a clickbait title. I don't *only* use UTC.

But for almost all database, backend, ops, and maintenance code I keep everything in UTC. Time zones show up at the very last display step. And even then, it's a setting the user can change whenever they want.

That one habit has saved me from a pile of bugs that are dumb, expensive, and politically painful to untangle.

## The real enemy is DST (and the people who "manage" it)

Daylight Savings Time in the US is a recurring prank. Twice a year, you get to wonder:

- Did the job run twice?
- Did it not run at all?
- Did we just lose an hour of data?
- Why is this timestamp "in the future"?

A lot of systems quietly assume time is predictable:

- Cron jobs
- Celery beat tasks
- Billing cycles
- "Send this email 30 minutes before the event"
- Metrics rollups ("group by hour")
- Log correlation across services

DST breaks the basic promise that "an hour later" is always "one hour later." Sometimes the hour never happens. Sometimes it happens twice.

And yes, Arizona mostly opts out, which means your code can be wrong in *different ways* depending on where the user lives. Great system.

I'm also glad politicians got to pick what time the sun rises and sets. I'm sure that went through rigorous testing.

### What DST bugs look like in real systems

A few concrete failure modes I've watched teams trip over:

1. **The "missing hour" appointment**
2. User schedules something for `2026-03-08 02:30` in a DST-observing timezone.
3. That local time might not exist.
4. Some libraries "fix" it by shifting forward to `03:30`.
5. Others raise an error.
6. Others store it anyway and you don't find out until reminders fail.
7. **The "duplicate hour" double charge**
8. At fall-back, `01:15` happens twice.
9. If you store naive local timestamps and later "group by hour," you can double count.
10. If you run a job "every hour" based on local wall time, you might run it twice.
11. **The "why are logs out of order" incident**
12. You're tracing a request across services.
13. Service A logs in Pacific time, Service B logs in UTC, Service C logs in whatever the container image default is.
14. You can't tell what happened first without doing timezone math while stressed.

DST bugs aren't hard in an interesting way. They're hard because they're intermittent and annoying. They show up twice a year, then disappear long enough for everyone to forget what happened.

### UTC on the server side means fewer late-night arguments

On a new team, I ask questions fast. What's breaking? Who's stuck? What's on fire? Where are the skeletons?

Time bugs show up in so many of those conversations. Logs and scheduled jobs are the usual hotspots. If your logs are in local time, debugging turns into a guessing game. If your database stores local time, you're signing up for extra confusion later.

UTC is consistent. That's the deal.

Consistent buys you:

- Sorting timestamps works everywhere.
- Comparing timestamps works everywhere.
- "Last 15 minutes" means the same thing everywhere.
- You can join tables on time ranges without special cases.
- Your on-call person doesn't need to know which states opted out of DST.

## Example: deployment tags that don't lie

I like date-time based deployment tags because they sort naturally, you can read them without a decoder ring, and they don't require a meeting to decode. Something like:

`202601011513-prod`
Meaning: **Jan 1st, 2026 at 15:13 UTC**, deployed to prod.

This same mindset works for log files, backups, and incident timelines. You want the system to behave like a machine, not like a moody teen.

### Why UTC tags are better than "v1.2.7" (sometimes)

Version numbers are fine, but they have issues:

- People forget to bump them.
- Two branches both bump to the same version.
- Hotfix naming gets silly fast.
- They tell you nothing about *when* something happened.

A UTC timestamp tag gives you:

- A built-in ordering
- A built-in "when"
- A stable reference for incident timelines ("the error started after 202601011513-prod")

If you tag deploys in local time, DST will eventually hand you two tags that look an hour apart but happened minutes apart. Or the reverse. Either way, now you're doing time math during an incident.

UTC tags avoid that. They also make cross-region ops sane. Your teammate in Berlin and your teammate in Seattle can read the same tag and agree on what happened.

### Implementation detail: generating the tag

Here's a simple Python snippet that generates the format reliably:

```python
from datetime import datetime, timezone

def deploy_tag(env: str) -> str:
    stamp = datetime.now(timezone.utc).strftime("%Y%m%d%H%M")
    return f"{stamp}-{env}"

print(deploy_tag("prod"))  # 202601011513-prod
```

If you want seconds too, use `%Y%m%d%H%M%S`. I usually don't bother.

Tradeoff: timestamp tags don't tell you what changed. That's what commit messages and release notes are for. The tag is just a coordinate on the timeline.

## Django: store UTC, show local time

Here's the pattern I use in Django:

1. **Store timestamps in UTC in the database**
2. **Convert to the user's timezone only at render time (template or serializer)**

In `settings.py`:

```python
USE_TZ = True
TIME_ZONE = "UTC"
```

Then in your model, just use normal Django fields:

```python
from django.db import models

class Event(models.Model):
    name = models.CharField(max_length=200)
    starts_at = models.DateTimeField()  # stored as UTC when USE_TZ=True
    created_at = models.DateTimeField(auto_now_add=True)
```

That's the easy part. The part that causes pain is what people do next.

Don't:

- Store local timestamps in the DB.
- Store naive datetimes and "remember" what timezone they were in.
- Convert to local time inside `save()`.
- Mutate stored timestamps because a user traveled.

### Handling user preference

Say the user has a saved timezone like `"America/Los_Angeles"`.

Store the timezone name, not an offset. `"UTC-8"` is not a timezone. It's a rough description that becomes wrong twice a year.

Example profile model:

```python
from django.conf import settings
from django.db import models

class Profile(models.Model):
    user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    timezone = models.CharField(max_length=64, default="UTC")  # IANA name
```

Now in your view:

```python
from django.shortcuts import render, get_object_or_404

def event_detail(request, event_id):
    event = get_object_or_404(Event, id=event_id)
    user_tz = getattr(request.user.profile, "timezone", "UTC")
    return render(request, "event_detail.html", {"event": event, "user_tz": user_tz})
```

In your template:

```django
{% load tz %}

{% timezone user_tz %}
  <p>Starts: {{ event.starts_at|date:"Y-m-d H:i:s T" }}</p>
{% endtimezone %}
```

Database stays UTC. Backend logic stays consistent. Users see local time. No surprises.

### Floating time vs absolute time

Some events are absolute. Some are "floating."

- **Absolute time:** "This webinar starts at 2026-01-01 15:13 UTC." Everyone sees a different local time. That's correct.
- **Floating time:** "This reminder should happen at 9:00 AM *wherever the user is*."

Floating time is where people get burned. If you store only UTC, "9:00 AM local" becomes "some UTC value" that depends on timezone rules and may change when the user changes zones.

How I handle it:

- Store the *intent* separately.
- `local_time = 09:00`
- `timezone = America/Los_Angeles` (or the user's current zone)
- Compute the next run in UTC at execution time.

That's more work. But it matches what the user meant. If you try to cram "floating time" into a single UTC timestamp forever, you'll eventually surprise someone.

### API version (DRF)

If you're using Django REST Framework, you can return UTC in the API (simple and consistent) and let the frontend localize. Or return both.

Example: return ISO 8601 UTC plus a user-local string:

```python
from django.utils import timezone
from zoneinfo import ZoneInfo

def to_user_local(dt, tz_name: str):
    tz = ZoneInfo(tz_name)
    return timezone.localtime(dt, tz)

## dt is aware UTC datetime from DB
local_dt = to_user_local(event.starts_at, user_tz)
```

Timezone conversion per row costs CPU. If you're returning 5,000 rows, you might prefer:

- API returns UTC only
- Frontend converts
- Or you paginate and keep conversions small

## My rule

- **UTC everywhere**
- **Time zones at the edges**
- **User's chosen timezone decides the final display**

Not fancy. Not innovative. It just prevents bugs that wake someone up in the middle of the night and teach them nothing useful.

If you want a simple checklist:

- Store timestamps as aware UTC datetimes.
- Store timezone as an IANA name (`America/New_York`), not an offset.
- Convert for display at the last step.
- Never rewrite history because a user took a flight.

UTC won't fix every time problem. But it wipes out the dumb ones, which is most of them. Similar to how [Excel's date handling quirks](https://www.sethserver.com/programming/the-insane-history-of-dates-in-excel.html) created decades of compatibility issues, time zone bugs compound when you don't establish clear conventions early.

-Sethers


```json
{"@context": "https://schema.org", "@type": "NewsArticle", "mainEntityOfPage": {"@type": "WebPage", "@id": "https://www.sethserver.com/programming/why-i-only-use-utc-and-why-you-should-too.html"}, "headline": "Why I Only Use UTC and Why You Should Too", "datePublished": "2026-03-03T18:46:11", "dateModified": "2026-06-29T05:17:32", "image": {"@type": "ImageObject", "url": "https://cdn.sethserver.com/blog-images/why-i-only-use-utc-and-why-you-should-too-social-1794887396.jpg", "width": 1200, "height": 630}, "url": "https://www.sethserver.com/programming/why-i-only-use-utc-and-why-you-should-too.html", "author": {"@type": "Person", "name": "Seth Black", "url": "https://www.linkedin.com/in/seth-black-tx"}, "publisher": {"@type": "Organization", "name": "Sethserver", "logo": {"@type": "ImageObject", "url": "https://www.sethserver.com/static/images/PaperAirplane512.png"}}, "description": "Learn why storing timestamps in UTC and only converting to local time zones at display time prevents costly DST bugs, scheduling errors, and logging chaos in backend systems. Includes practical Django examples for timezone handling, deployment tagging, and user preference management.", "articleSection": "Technology"}
{"@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{"@type": "ListItem", "position": 1, "name": "sethserver", "item": "https://www.sethserver.com/"}, {"@type": "ListItem", "position": 2, "name": "Programming", "item": "https://www.sethserver.com/programming/"}, {"@type": "ListItem", "position": 3, "name": "Why I Only Use UTC and Why You Should Too", "item": "https://www.sethserver.com/programming/why-i-only-use-utc-and-why-you-should-too.html"}]}
```
