[Python] How to add seconds (can go upto 10E12) to a datetime variable in python?

Discussão em 'Python' iniciado por Stack, Novembro 21, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using Python and I need to add a variable which has seconds in it to a datetime variable.

    The variable which has the seconds stored and the date to which it should be added looks like this. But I couldn't get it correct as timedelta has only upto days.

    sec_var = 1.83920792079208E+04
    print st_ti
    2013-01-01 00:00:00


    Note: The sec_var can go upto 10(pow)12 which means I need to take care till years.

    So basically I need the seconds value to get added to the date variable.

    How do I solve this?

    Continue reading...

Compartilhe esta Página