Visitar URL original
datetime.timestamp() fails before 1970-01-02T01:00:00.000000 · Issue #94414 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20250608192116/https://github.com/python/cpython/issues/94414
Skip to content

datetime.timestamp() fails before 1970-01-02T01:00:00.000000 #94414

Closed as duplicate of#81708
@dtyeos

Description

@dtyeos

Python 3.8.10
datetime 4.4
Windows 10

datetime(1970,1,1,0,0,0).timestamp()  # OSError: [Errno 22] Invalid argument
datetime(1970,1,1,23,59,59,999999).timestamp()  # OSError: [Errno 22] Invalid argument
datetime(1970,1,2,0,59,59,999999).timestamp()  # OSError: [Errno 22] Invalid argument

Minimal datetime where timestamp() is fine:

datetime(1970,1,2,1,0,0).timestamp()  # 86400.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsextension-modulesC modules in the Modules dirstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions