Dates & Time
Timestamps, UTC and time-zone traps.
Dates & Time is taught here in 14 lessons, running from Unix timestamps & UTC through to Internationalisation: locales, calendars and relative time. Each lesson takes one topic, shows the working code, and links onward to the next, so the course can be read straight through in order.
| Track | Computer Science Fundamentals |
| Lessons | 14 |
| Level | Beginner to intermediate |
| Reading time | about 3 hours |
| Prerequisites | Helpful, but not required: Data Formats |
Lessons
- Unix timestamps & UTCWhy storing time as a single number avoids almost every timezone bug, and the 2038 problem you should know about.
- Time zones & UTC offsetsWhy 'UTC+8' lies, what IANA zone names are for, and how to avoid the classic off-by-one date bugs.
- Calendars, leap years and leap secondsThe Gregorian leap rule including the 100 and 400 exceptions, why month lengths vary, how ISO week numbering works, and what leap seconds do to a clock that claims to be exact.
- ISO 8601 and RFC 3339 formatsThe exact syntax for dates, times, offsets and fractions, what the Z suffix means, how to write durations and intervals, and why interchange should use these formats and nothing else.
- Parsing and formatting dates safelyWhy 03/04/2026 is unparseable without a convention, how strict parsers prevent silent errors, and how to emit locale-independent output for machines.
- Durations, periods and intervalsInstants versus durations versus calendar periods, why adding one month to 31 January has no single answer, business-day arithmetic, and how to round and truncate consistently.
- Daylight saving and its edge casesSpring-forward gaps, fall-back repeats, the difference between a nonexistent and an ambiguous local time, and the scheduling rules that avoid double-running or skipping a job.
- Monotonic clocks and elapsed timeWhy wall clock time is the wrong tool for measuring duration, what a monotonic clock guarantees, and how to measure latency and timeouts without NTP jumps wrecking the result.
- Date libraries compareddate-fns and Luxon, Day.js and the Moment migration path, java.time, Python datetime with zoneinfo, and Go's time package — with the mental model each one imposes.
- Storing dates in databasesDATE, TIME, TIMESTAMP and TIMESTAMPTZ, why epoch integers lose meaning, the store-in-UTC convention, index-friendly range queries, and per-dialect traps.
- Scheduling, cron and time-based triggersCron syntax and its five fields, why schedules must name a zone, misfires and catch-up behaviour, at-least-once versus exactly-once, and durable timers.
- The 2038 problem and 32-bit timeSigned 32-bit overflow on 19 January 2038, which systems and file formats are affected, how SMS and embedded time counters differ, and how to plan a migration.
- Testing time-dependent codeInjectable clocks instead of global stubs, freezing and travelling time in tests, deterministic inputs, fake timers for scheduled work, and testing across zone boundaries.
- Internationalisation: locales, calendars and relative timeLocale-aware formatting with Intl, numbering systems, non-Gregorian calendars, relative phrases and their limits, and the bundle-size cost of shipping CLDR data.
More in Computer Science Fundamentals
Algorithms Data Structures Computer Networks Operating Systems Character Encodings Hashing & Checksums Data Formats Regular Expressions
FAQ
How long does the Dates & Time course take?
It has 14 lessons, about 3 hours of reading. Expect roughly twice that if you type out and run every example.
Do I need prior experience for Dates & Time?
Not strictly. It helps to have read Data Formats first, because some lessons build on it, but every lesson explains its own assumptions.
What should I read after Dates & Time?
Continue with Regular Expressions (13 lessons), the next course in Computer Science Fundamentals.