Advertisement
here2share

# add_days.py

Jul 19th, 2022
1,264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. # add_days.py
  2.  
  3. from datetime import datetime, timedelta
  4.  
  5. def add_days(n, d = datetime.today()):
  6.   return d + timedelta(n)
  7. from datetime import date
  8. '''
  9. add_days(5, date(2020, 10, 25)) # date(2020, 10, 30)
  10. add_days(-5, date(2020, 10, 25)) # date(2020, 10, 20)
  11. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement