Advertisement
Guest User

Untitled

a guest
Dec 26th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. t1 = "26-12-2014 17:00"
  2. t2 = "27-12-2014 08:00"
  3.  
  4.  
  5. from datetime import datetime
  6.  
  7. t1 = datetime.strptime(t1,"%d-%m-%Y %H:%M")
  8. t2 = datetime.strptime(t2,"%d-%m-%Y %H:%M")
  9. hours, minutes =  divmod((t2- t1).seconds,3600)
  10.  
  11. print("Total hours = {}, minutes = {}".format(hours,minutes//60))
  12. Total hours = 15, minutes = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement