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.

TrackComputer Science Fundamentals
Lessons14
LevelBeginner to intermediate
Reading timeabout 3 hours
PrerequisitesHelpful, but not required: Data Formats

Lessons

  1. Unix timestamps & UTCWhy storing time as a single number avoids almost every timezone bug, and the 2038 problem you should know about.
  2. Time zones & UTC offsetsWhy 'UTC+8' lies, what IANA zone names are for, and how to avoid the classic off-by-one date bugs.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. 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.
  14. 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.