Skip to content

Add n days to today’s date in Python

Advertisements

from datetime import datetime, timedelta

#Current day
print datetime.today()
#2020-12-13 05:01:30.689604


#Add five days
print datetime.today() + timedelta(5)
#2020-12-18 05:01:30.689652


#Add One day
print datetime.today() + timedelta(1)
#2020-12-14 05:01:30.689684

See also  TypeScript code snippet - using log How can we find number of digits for a number in java?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.