Friday 15 July 2016

Python: time.gmtime: Convert seconds to struts_time tuple in UTC


time.gmtime([secs]) is used to convert time expressed in seconds to struts_time in UTC. If parameter secs is not provided, then value return by time() is used.
>>> import time
>>> time.gmtime()
time.struct_time(tm_year=2015, tm_mon=11, tm_mday=10, tm_hour=5, tm_min=25, tm_sec=58, tm_wday=1, tm_yday=314, tm_isdst=0)
>>> 
>>> time.gmtime(0)
time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)
>>> 
>>> time.gmtime(1000000000)
time.struct_time(tm_year=2001, tm_mon=9, tm_mday=9, tm_hour=1, tm_min=46, tm_sec=40, tm_wday=6, tm_yday=252, tm_isdst=0)
>>> 
>>> time.gmtime(10000000000)
time.struct_time(tm_year=2286, tm_mon=11, tm_mday=20, tm_hour=17, tm_min=46, tm_sec=40, tm_wday=5, tm_yday=324, tm_isdst=0)
>>> 
>>> time.gmtime(100000000000)
time.struct_time(tm_year=5138, tm_mon=11, tm_mday=16, tm_hour=9, tm_min=46, tm_sec=40, tm_wday=2, tm_yday=320, tm_isdst=0)
>>> 
>>> time.gmtime(1000000000000)
time.struct_time(tm_year=33658, tm_mon=9, tm_mday=27, tm_hour=1, tm_min=46, tm_sec=40, tm_wday=4, tm_yday=270, tm_isdst=0)



Previous                                                 Next                                                 Home

No comments:

Post a Comment