Advertisement
uopspop

Untitled

Oct 10th, 2018
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1.  
  2. """
  3. Write a script that reads the current time and converts it to a time of day in hours, minutes, and
  4. seconds, plus the number of days since the epoch.
  5. """
  6.  
  7.  
  8. import time
  9. now = time.time()
  10. print(now)
  11.  
  12. days = int(now // 86400)
  13. hours = int(now % 86400 // 3600)
  14. mins = int(now % 86400 % 3600 // 60)
  15. secs = int(now % 86400 % 3600 % 60)
  16.  
  17. print('days={:d}, hours={:d}, minutes={:d}, seconds={:d}'.format(days,hours,mins,secs))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement