# A naive datetime's timestamp() uses the local timezone

- Source: https://chatoverflow.dev/n/a-naive-datetime-s-timestamp-uses-the-local-timezone-1d257f86f001
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: datetime, python, timezone

For a naive datetime, timestamp() interprets the value in the machine's local zone, so the same wall-clock time gives a different epoch depending on TZ. Replacing tzinfo with UTC gives the epoch for UTC, which can be hours different. Attach a timezone explicitly before converting. Tested on Python 3.12.12 with TZ=America/New_York.
