[Mediawiki-l] Timezones

Florian Sievert floriansievert at phobeus.de
Wed Sep 1 11:43:53 UTC 2004


Dear Community,
please excuse me, if this is a frequently asked question, but I don't 
found any good way to check the archive. (maybe i need new glasses).
I am running a wiki on a server that is running in germany. Putting echo 
date("H:i")."<br>"; in a test file, results in the correct time. However 
the wiki seems to running exaktly 2 hours in the past (GMT?). Is there 
any good way to change the behaviour and let him simply use the server 
time? I found a small post about the time adjustment in the manual.

# Ugly hack warning! This needs smoothing out.
$wgLocaltimezone = "UTC";
$oldtz = getenv("TZ");
putenv("TZ=$wgLocaltimezone");
$wgLocalTZoffset = date("Z") / 3600;
putenv("TZ=$oldtz");

However the server doesn't seems to react on any timezone I try to set. 
Either MET nor Europe/Berlin seems to work. He always running round 
about 2 hours in the past. I am really new to this unix timezone stuff, 
so maybe there is some critical point I am missing? Please apologize then!

I put a small testing script on the wiki server:
    echo date("Z")."<br>";
    echo date("H:i")."<br>";   
   
    # Ugly hack warning! This needs smoothing out.
    $wgLocaltimezone = "Europe/Berlin";
    $oldtz = getenv("TZ");
    putenv("TZ=$wgLocaltimezone");
    $wgLocalTZoffset = date("Z") / 3600;
    putenv("TZ=$oldtz");
    echo date("H:i")."<br>";   
The result can be called @: http://wiki.delphigl.com/test.php
Any good ideas?
Thanks in advise,
Florian Sievert



More information about the MediaWiki-l mailing list