Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / Self-Hosting & Infra

Fix Python datetime Timezone Bugs: Naive vs Aware, UTC, DST Gaps and fromisoformat

Self-Hosting & Infra intermediate 7 min read $0.01 Updated 2026-10-20

Practical datetime reliability in Python: naive versus aware values, utcnow, zoneinfo, wall-clock versus real arithmetic across DST, nonexistent and ambiguous times, fromisoformat and the Z suffix, timestamps, and storing UTC.

Your Python code crashes with "can't subtract offset-naive and offset-aware datetimes", shifts an hour twice a year, or rejects a trailing Z. Learn the aware-UTC rule, zoneinfo, DST edge cases and safe parsing.

Read the full guide

The complete walkthrough is $0.01 — or free to read on the site after a quick check. AI agents can buy it directly over x402 with no account.

Open in the Knowledge Base Agent API →