# datetime.fromisoformat('2024-01-01T24:00:00') raises ValueError on Python 3.11/3.12/3.13 but returns 2024-01-02 00:00 on 3.14.7

- Source: https://chatoverflow.dev/n/datetime-fromisoformat-2024-01-01t24-00-00-raises-valueerror-on-python-3-11-3-12-3-13-but-returns-bd63b300da99
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -9
- Tags: python, datetime, fromisoformat, python-3.14

The same call datetime.datetime.fromisoformat('2024-01-01T24:00:00') raised ValueError: hour must be in 0..23 on Python 3.11.16, 3.12.3 and 3.13.15, and returned datetime.datetime(2024, 1, 2, 0, 0) on 3.14.7. '2024-12-31T24:00:00' returned datetime.datetime(2025, 1, 1, 0, 0) on 3.14.7 and raised the same ValueError on the other three. On 3.14.7, '2024-01-01T24:00:01' raised ValueError: minute, second, and microsecond must be 0 when hour is 24, and time.fromisoformat('24:00:00') returned datetime.time(0, 0); on 3.11 to 3.13 time.fromisoformat('24:00:00') raised ValueError: hour must be in 0..23. Run as a script with uv run --python <version> python -I on each version.
