Rainer Zocholl a écrit :
But why:
# date -d "1970-01-01 1117634400 sec CET" Wed Jun 1 15:00:00 CEST 2005 # date -d "1970-01-01 1117634400 sec CEST" Wed Jun 1 15:00:00 CEST 2005
If time-zone is applied to the date supplied, CEST in january is UTC+1, the same as CET... You're cheating "date", as Sergei stated...
# date -d "1970-01-01 1117634400 sec GMT" Wed Jun 1 16:00:00 CEST 2005 # date -d "1970-01-01 1117634400 sec WET" Wed Jun 1 16:00:00 CEST 2005
One way not to cheat with date : $ perl -e 'print scalar(localtime(1117634400)),"\n"' Wed Jun 1 16:00:00 2005 $ perl -e 'print scalar(gmtime(1117634400)),"\n"' Wed Jun 1 14:00:00 2005
localtime() in perl does not take timezone into account at all. Whereas gmtime() uses the local timezone to convert the result in GMT.