Hi monks, I need your help.
I wrote a cgi script that basically needs to transform UTC time to CEST time and vice versa. Using my basic skills and Google I came around with something like this to initialize my local timezone:
use Time::Local; use POSIX qw(tzset); $ENV{TZ} = 'Europe/Berlin'; tzset();
Reading a UTC timestamp from a database and transforming it to localtime works great when running the skript locally, but when called as a cgi from a browser, the same script fails in doing so and all dates are UTC.
Adding some debug code I found out that the tzset call does not seem to affect the system timezone. Here is the code:
($std, $dst) = POSIX::tzname(); system ("echo $std x $dst > /tmp/cgi.out"); system ("echo $ENV{TZ} >> /tmp/cgi.out");
The output reads "CET x CEST Europe/Berlin" when run locally and "UTC x Europe/Berlin" when run as cgi. Do you have any idea why this happens?
Additional info: perl 5.8.8 on AIX 6.1, Webspere Aplication Server 7x
In reply to strange localtime behaviour in cgi by ReSpawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |