Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import datetime, timedelta
- def pass_date(year, month, date, hour, minute, second, msecond):
- return datetime(year, month, date, hour, minute, second, msecond)
- year, month, date, hour, minute, second, msecond = map(int, input("Enter your date object in the format 'year month date hour minute second msecond':").split())
- x = pass_date(year, month, date, hour, minute, second, msecond)
- print("Passed date:", x)
- print(x.strftime("Day is %a/%A"))
- add_time = x + timedelta(days=2, hours=3, minutes=15)
- print("After Adding Time:", add_time)
- sub_time = x - timedelta(days=4, hours=6, minutes=23)
- print("After Subtracting Time:", sub_time)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement