[Python] How in python can I transform negative secs into struct time?

Discussão em 'Python' iniciado por Stack, Agosto 23, 2025.

  1. Stack

    Stack Membro Participativo

    I'd like to transform -238204800 seconds to "1962:06:15 00:00:00", using python 3.8.

    My code is :

    from time import strftime, localtime
    secs = -238204800
    print(strftime("%Y:%m:%d %H:%M:%S", localtime(secs))


    localtime() gives OSError: [Errno 22] Invalid argument.

    How can I proceed such dates, given negative seconds ?

    Continue reading...

Compartilhe esta Página