How to add seconds to a datetime in Python

Adding seconds to a datetime.datetime results in a new datetime.datetime holding the date and time adjusted with the desired additional seconds.

Solution for How to add seconds to a datetime in Python : You can use datetime.timedelta() to add seconds to a datetime Call datetime.timedelta(days, seconds) with days set to 0 and specify the amount of seconds to get a duration of seconds. Add this duration of seconds to a datetime.datetime object to return a new datetime.datetime object with the adjusted time.


how-to-add-seconds-to-a-datetime-in-python