Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- print('What do you want to do?')
- print('1. Addd the date')
- print('2. Subtract the date')
- print()
- choice= int(input('Your choice:'))
- date = datetime.datetime.now()
- print('Today is:',date.year, '-', date.month, '-', date.day)
- days_= int(input('Enter the number of days here:'))
- def date_total():
- time_delta = datetime.timedelta(days=days_)
- date_add= date + time_delta
- year = date_add.year
- month = date_add.month
- day = date_add.day
- print('in', days_, 'it will be:', year, '-', month, '-', day)
- def date_difference():
- time_delta = datetime.timedelta(days=days_)
- date_subtract = date - time_delta
- year = date_subtract.year
- month = date_subtract.month
- day = date_subtract.day
- print(days_, 'days ago was the date:', year, '-', month, '-', day)
- if choice == 1:
- date_total()
- if choice == 2:
- date_difference()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement