Bon ben dans dateime, tu peux formater des heures avec ou sans le TZ mais je n'ai pas vu de fonction pour récupere le TZ local de la machine.
Donc ... On verra plus tard.
Code : #
print(time.tzname)
>>>"IST" # pour Indian Standard TimeCode : #
import time
print(time.localtime())
print(time.gmtime())
Code : #
>>> import time
>>> print(time.localtime())
time.struct_time(tm_year=2016, tm_mon=2, tm_mday=25, tm_hour=11, tm_min=44, tm_sec=26, tm_wday=3, tm_yday=56, tm_isdst=0)
>>> print(time.gmtime())
time.struct_time(tm_year=2016, tm_mon=2, tm_mday=25, tm_hour=16, tm_min=44, tm_sec=36, tm_wday=3, tm_yday=56, tm_isdst=0)
>>> Code : #
>>> time.localtime()
time.struct_time(tm_year=2016, tm_mon=2, tm_mday=25, tm_hour=22, tm_min=49, tm_sec=53, tm_wday=3, tm_yday=56, tm_isdst=0)
>>> time.gmtime()
time.struct_time(tm_year=2016, tm_mon=2, tm_mday=25, tm_hour=17, tm_min=19, tm_sec=57, tm_wday=3, tm_yday=56, tm_isdst=0)