{
  "id": "python-datetime-table",
  "kind": "table",
  "slug": "python-datetime",
  "iil_id": null,
  "note_url": "https://iinventedlight.com/library/notes/python-datetime/",
  "title": "Python datetime - aware UTC timestamps, ISO 8601 parsing and timedelta math",
  "columns": [
    "name",
    "source",
    "detail"
  ],
  "rows": [
    {
      "name": "datetime.utcnow()",
      "source": "Python docs",
      "detail": "returns a naive datetime and is deprecated since version 3.12; use datetime.now() with UTC instead."
    },
    {
      "name": "fromisoformat()",
      "source": "Python docs",
      "detail": "accepts any valid ISO 8601 format, with exceptions: reduced precision dates (YYYY-MM), extended dates and ordinal dates are not supported, nor are fractional hours and minutes."
    },
    {
      "name": "strptime(date_string, format)",
      "source": "Python docs",
      "detail": "parses according to a format; a %d without a year raises ValueError, so always include a year in your format."
    },
    {
      "name": "astimezone(tz)",
      "source": "Python docs",
      "detail": "returns the same UTC time as self, adjusted to the local time of tz. On a naive datetime, it presumes the system time zone."
    }
  ],
  "related_slugs": [
    "python-f-strings",
    "python-json",
    "python-dataclasses"
  ],
  "license": "CC-BY-4.0",
  "source_license": "PSF-2.0 (Python docs); PSF-2.0 (python/cpython (GitHub)); prose restates cited source lines in own words",
  "as_of": "2026-11-18",
  "status": "fill-draft-20261118",
  "note": "Restated from the note's GREEN sources; check those sources before relying on a value."
}