laiko rodymas

M
  • 19 Vas '10

Kodel man pythonas blogai rodo valandas? Visada atsilieka 4 valandom nuo rodomo kompiuterio laiko.

from time import gmtime, strftime
print strftime('%Y %m %d %H %M %S ', gmtime())

S
  • 19 Vas '10

Štai, kas rašoma apie gmtime:

gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,
                       tm_sec, tm_wday, tm_yday, tm_isdst)

Convert seconds since the Epoch to a time tuple expressing UTC
(a.k.a. GMT).  When 'seconds' is not passed in, convert the
current time instead.

Laiką iš tavo kompiuterio pasirinktos laiko juostos grąžins toks kodas:

from time import localtime, strftime
print strftime('%Y %m %d %H %M %S ', localtime())