i know using datetime.timedelta i can get the date of some days away form given date
daysafter = datetime.date.today() + datetime.timedelta(days=5)
but seems no datetime.timedelta(month=1)
datetime() to format the given date . Then, Use givenDate + datetime. timedelta(days=1) to add one day from the given date and print result as next date in python.
Use dateutil
module. It has relative time deltas:
import datetime from dateutil import relativedelta nextmonth = datetime.date.today() + relativedelta.relativedelta(months=1)
Beautiful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With