Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. start_time = 1234566
  2. end_time = 1234578
  3.  
  4. >>> import time
  5. >>> time.gmtime(123456)
  6. time.struct_time(tm_year=1970, tm_mon=1, tm_mday=2, tm_hour=10, tm_min=17, tm_sec=36, tm_wday=4, tm_yday=2, tm_isdst=0)
  7.  
  8. 2012-09-12 21:00:00
  9.  
  10. `TypeError: a float is required`
  11.  
  12. mend = time.gmtime(getbbb_class.end_time).tm_hour
  13.  
  14. time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(1347517370))
  15.  
  16. In [1]: time.time()
  17. Out[1]: 1347517739.44904
  18.  
  19. In [2]: time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(time.time()))
  20. Out[2]: '2012-09-13 06:31:43'
  21.  
  22. >>> import time
  23. >>> time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(1347517119))
  24. '2012-09-12 23:18:39'
  25.  
  26. INSERT INTO tblname VALUES (FROM_UNIXTIME(1347517119))
  27.  
  28. The ctime(), gmtime() and localtime() functions all take an argument of data type time_t which represents calendar time. When inter-
  29. preted as an absolute time value, it represents the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal
  30. Time (UTC).
  31.  
  32. >>> time.time()
  33. 1347517171.6514659
  34. >>> time.gmtime(time.time())
  35. (2012, 9, 13, 6, 19, 34, 3, 257, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement