Manual:Timezone

The default Timezone (tz) for users who have not specified a custom offset may be configured manually.

Primary Method

 * Create a backup copy of the LocalSettings.php file found in your install directory
 * Edit LocalSettings.php and add the following code:
 * Set the '$wgLocaltimezone' value to the proper value which you can find here. See examples below.

''Note: This timezone will be used in:
 * ~ signatures
 * timestamps in recentchanges
 * timestamps in history''

Note: Upload and deletion logs will probably still be listed in UTC Note: This method has been confirmed to work on MediaWiki: 1.5.6. Note: The $wgLocalTZoffset configuration changed from hours to minutes in MediaWiki: 1.7.0. Note: Adding this code to the LocalSettings.php in version 1.14 breaks the emailing features (E-Mail New Password, Create User by E-Mail) ''Note: Adding this code to the LocalSettings.php conflicts with the RSS Feed dates in Extension:RSS. See the Discussion page of Extension:RSS for more information''

Alternative Method
This method has been confirmed by multiple users in situations where the primary method has not worked.

$wgLocaltimezone = "America/Sao_Paulo"; $dtz = new DateTimeZone($wgLocaltimezone); $dt = new DateTime('now', $dtz); $wgLocalTZoffset = $dtz->getOffset($dt) / 60; unset($dtz); unset($dt);

Alternative Methods
If you just want to use the local time of your PC, you can just add this line in your LocalSettings.php. This method is what MediaWiki does by default (see includes/Setup.php); it also avoids problems with daylight saving time:

Unconfirmed Methods

 * To use your local time zone (say NZDT) put this in LocalSettings.php


 * This example may also work great
 * In my case the primary method did not take daylight saving time into account. The next example works for me:

I cannot test daylightsavings right now, so you probably have to combine it with the tip above to make that work. Note: The methods in this section are unconfirmed and may not work properly.
 * To make it work in 1.5.8 I had to specify the offset in hours, so change all occurences of '/ 60' to '/ 3600', e.g.
 * This line is all I need in 1.16. It applies to both anonymous and logged in users. Note that you will need to provide the correct values if you want the zone to be selected by default in the timezone dropdown:

Manual Timezone Specification
The primary method needs the server to support the 'tz' database; some non-GNU hosts don't do that. You can supply timezone data manually; see Specifying the Time Zone with TZ, System configuration: Time Zones and timezones.conf.xml for details.

E.g. use
 * instead of


 * or


 * instead of

Specify The Default User's Timezone Offset
In the PHP safe mode, the ways described above may not work since PHP's putenv function is disabled. Alternatively, you can use $wgDefaultUserOptions variable. For instance, If you live in Asia/Tokyo(UTC+9) and want to do "+09:00" time zone correction, add the following code to LocalSettings.php.

After changing the file, don't forget to purge the cache of articles.