Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import datetime as dt
- recent_time = dt(1990, 12, 24)
- past_time = dt(1982, 7, 1)
- # recent_time = dt(1990, 12, 24, 00, 00, 00)
- # past_time = dt(1990, 11, 24, 00, 00, 00)
- print('Recent:', 1*'\t',recent_time)
- print('Past:', 2*'\t',past_time)
- time_delta = recent_time-past_time
- print('Difference:', 1*'\t', time_delta)
- minutes = time_delta.total_seconds() / 60
- print('Total minutes:', '\t', minutes)
- hours = minutes / 60
- print('Total hours:', '\t', hours)
- days = hours / 24
- print('Total days:', '\t', days)
- weeks = days / 7
- print('Total weeks:', '\t', weeks)
- months = weeks / 4
- print('Total months:', '\t', months)
- years = months / 12
- print('Total years:', '\t', years)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement