Mailing List Archive

How do I adjust the time on my Wiki?
Hello,

Just installed a Wiki a few days ago, works fine so far, but the time is
set to GMT, but since this is a German Wiki most of my visitors would
probably prefer CET. :) How would I be able to adjust the time
Wiki-wide? (not just via user preferences)

Thanks.
Re: How do I adjust the time on my Wiki? [ In reply to ]
On Mon, Apr 12, 2004 at 08:08:53PM +0200, Tom Veidt wrote:
> Hello,
>
> Just installed a Wiki a few days ago, works fine so far, but the time is
> set to GMT, but since this is a German Wiki most of my visitors would
> probably prefer CET. :) How would I be able to adjust the time
> Wiki-wide? (not just via user preferences)

In LocalSettings.php add:

$wgLocalTZoffset = "-5";

Adjust the value for CET obviously :)
Re: How do I adjust the time on my Wiki? [ In reply to ]
Can anybody describe how time is actually handled by MediaWiki?

- where is the current time taken from?
- how does wgLocalTZoffset relate to that time?
- how is daylight saving time integrated?

I would expect that I set up my server to provide UTC and MediaWiki to
handle all time as UTC internally as well. So wgLocalTZoffset is an
offset that is added on output.

On the other hand, shouldn't be this a user setting?

Greetings
Tim


On 12.04.2004, at 22:19, Jason Smithson wrote:

> On Mon, Apr 12, 2004 at 08:08:53PM +0200, Tom Veidt wrote:
>> Hello,
>>
>> Just installed a Wiki a few days ago, works fine so far, but the time
>> is
>> set to GMT, but since this is a German Wiki most of my visitors would
>> probably prefer CET. :) How would I be able to adjust the time
>> Wiki-wide? (not just via user preferences)
>
> In LocalSettings.php add:
>
> $wgLocalTZoffset = "-5";
>
> Adjust the value for CET obviously :)
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l@Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>
>

------
Tim Pritlove, Discordian Evangelist, Chaos Computer Club
<mailto:tim@ccc.de> <http://tim.geekheim.de/> <aim:timpritlove>
Project Blinkenlights <http://www.blinkenlights.de/>
------
The Fifth Commandment:
A Discordian is Prohibited of Believing What he reads.
Re: How do I adjust the time on my Wiki? [ In reply to ]
On Apr 12, 2004, at 13:46, Tim Pritlove wrote:
> Can anybody describe how time is actually handled by MediaWiki?
>
> - where is the current time taken from?

UTC is always used to store times internally and is the default
timezone used for display. Your server should, hopefully, have the
correct time set or this can be wrong. (If using multiple web servers
on one database, as we do for Wikipedia, the web servers should have
their clocks synchronized.)

One exception is the time displayed for signatures (typing ~~~~ in a
page); this will be displayed according to the server's local timezone
setting.

> - how does wgLocalTZoffset relate to that time?

Hours plus or minus. CET would be 1, CEST 2. Over here in California
I'd want -7 in summer or -8 otherwise. $wgLocalTZoffset sets the
default for display, and can be overridden in user preferences.

> - how is daylight saving time integrated?

It is blissfully ignored. :)

If you want to set the default timezone offset according to local
timezone and handle daylight savings time automatically, you can do
this ugly trick:
$wgLocaltimezone="Europe/Berlin";
$oldtz = getenv("TZ");
putenv("TZ=$wgLocaltimezone");
$wgLocalTZoffset = date("Z") / 3600;
putenv("TZ=$oldtz");

Actually, resetting it probably isn't necessary, I think that's
leftover from before we switched to the proper time functions. This
should do (untested):
$wgLocaltimezone="Europe/Berlin";
putenv("TZ=$wgLocaltimezone");
$wgLocalTZoffset = date("Z") / 3600;

For that matter if your server is already in the local timezone you
want, this might work:
$wgLocalTZoffset = date("Z") / 3600;

I'm not 100% sure offhand how non-integral timezones are handled (there
are half-hour and quarter-hour offsets).

> I would expect that I set up my server to provide UTC and MediaWiki to
> handle all time as UTC internally as well. So wgLocalTZoffset is an
> offset that is added on output.
>
> On the other hand, shouldn't be this a user setting?

It is. Go into Preferences and select your timezone offset.

-- brion vibber (brion @ pobox.com)
Re: How do I adjust the time on my Wiki? [ In reply to ]
Jason Smithson wrote:
> In LocalSettings.php add:
>
> $wgLocalTZoffset = "-5";
>
> Adjust the value for CET obviously :)

Ah, many thanks. I already looked in LocalSettings.php/.sample but
couldn't find this variable. Is there somewhere an overview over all
existing LocalSettings variables?
Re: How do I adjust the time on my Wiki? [ In reply to ]
On Apr 12, 2004, at 14:13, Tom Veidt wrote:
> Jason Smithson wrote:
>> In LocalSettings.php add:
>> $wgLocalTZoffset = "-5";
>> Adjust the value for CET obviously :)
>
> Ah, many thanks. I already looked in LocalSettings.php/.sample but
> couldn't find this variable. Is there somewhere an overview over all
> existing LocalSettings variables?

DefaultSettings.php.

-- brion vibber (brion @ pobox.com)
Re: How do I adjust the time on my Wiki? [ In reply to ]
Brion Vibber wrote:
>
> DefaultSettings.php.
>

Great, thanks again. ;)