Jump to content

Руководство:Часовой пояс

From mediawiki.org
This page is a translated version of the page Manual:Timezone and the translation is 27% complete.

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
  • метках времени в свежих правках
  • метках времени в истории

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