Advertisement
rfmonk

time_struct.py

Jan 17th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import time
  4.  
  5.  
  6. def show_struct(s):
  7.     print ' tm_year   :', s.tm_year
  8.     print ' tm_mon    :', s.tm_mon
  9.     print ' tm_mday   :', s.tm_mday
  10.     print ' tm_hour   :', s.tm_hour
  11.     print ' tm_min    :', s.tm_min
  12.     print ' tm_sec    :', s.tm_sec
  13.     print ' tm_wday   :', s.tm_wday
  14.     print ' tm_yday   :', s.tm_yday
  15.     print ' tm_isdst  :', s.tm_isdst
  16.  
  17. print 'gmtime:'
  18. show_struct(time.gmtime())
  19. print '\nlocaltime:'
  20. show_struct(time.localtime())
  21. print '\nmktime:', time.mktime(time.localtime())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement