Skip to content

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

@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 dirstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions