Manual:Timezone
This page is about configuring the default Timezone (tz) for users who have not specified a custom offset in their preferences. The timezone is used in the following places:
- signatures
- timestamps in recentchanges
- timestamps in history
Default value
The default value is taken from the web server configuration in the "php.ini" file. See the documentation on PHP.net for the date.timezone configuration option
Configuration
Local timezone
The local timezone is set with the configuration parameter $wgLocaltimezone . Possible values are documented in the list of tz database zones.
- Example
$wgLocaltimezone = "Australia/Sydney";
Timezone offset
Defining the timezone offset with configuration parameter $wgLocalTZoffset is usually not required.
Timecorrection
The time correction is set with configuration parameter $wgDefaultUserOptions and preference name "timecorrection
". It respects the calculated offset and timezone dynamically. It applies to anonymous users and new user accounts which have not changed their preferences.
- Value
$wgDefaultUserOptions['timecorrection'] = 'ZoneInfo|0|' . $wgLocaltimezone;
ZoneInfo
, as MediaWiki's identifier for this timezone format, handles everything dynamically, i.e., MediaWiki calculates the correct offset based on the given timezone. The configuration defines a fixed pattern that does not change no matter which timezone is set for the wiki. See the examples below.
Examples
- Australia/Sydney
$wgLocaltimezone = 'Australia/Sydney';
$wgDefaultUserOptions['timecorrection'] = 'ZoneInfo|0|' . $wgLocaltimezone;
- America/Buenos_Aires
$wgLocaltimezone = 'America/Buenos_Aires';
$wgDefaultUserOptions['timecorrection'] = 'ZoneInfo|0|' . $wgLocaltimezone;
- Europe/Berlin
$wgLocaltimezone = 'Europe/Berlin';
$wgDefaultUserOptions['timecorrection'] = 'ZoneInfo|0|' . $wgLocaltimezone;
See also
- $wgLocaltimezone - Sets the timezone for the wiki.
- $wgLocalTZoffset - Sets the offset from UTC in minutes for the default timezone.