Sunday 2 May 2021

How to add seconds on a datetime value in Python?

 Have you checked out timedeltas?

from datetime import datetime, timedelta
x = datetime.now() + timedelta(seconds=3)
x += timedelta(seconds=3)


from : https://stackoverflow.com/questions/787564/how-to-add-seconds-on-a-datetime-value-in-python/787583

No comments:

Post a Comment