Difference between revisions of "Help:Timezone"

From lensowiki
Jump to: navigation, search
m
 
(5 intermediate revisions by 4 users not shown)
Line 50: Line 50:
 
$oldtz = getenv("TZ");
 
$oldtz = getenv("TZ");
 
putenv("TZ=$wgLocaltimezone");
 
putenv("TZ=$wgLocaltimezone");
$wgLocalTZoffset = date("Z") / 3600   Date("I");
+
$wgLocalTZoffset = date("Z") / 3600 + Date("I");
 
putenv("TZ=$oldtz");
 
putenv("TZ=$oldtz");
 
</pre>
 
</pre>

Latest revision as of 07:00, 7 June 2007

  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 Default Timezone
$wgLocaltimezone = "America/Los_Angeles";
$oldtz = getenv("TZ");
putenv("TZ=$wgLocaltimezone");
$wgLocalTZoffset = date("Z") / 3600;
putenv("TZ=$oldtz");
  • Set the '$wgLocaltimezone' value to the proper value which you can find here. See examples below.
$wgLocaltimezone = "Europe/London";
$wgLocaltimezone = "Asia/Taipei";

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.

Unconfirmed Methods

  • If you just want to use the local time of your PC, you can just add this line in your LocalSettings.php:
$wgLocalTZoffset = date("Z") / 3600;

  • To use your local time zone (say NZDT) put this in LocalSettings.php
$wgLocalTZoffset = 13;

  • In my case the primary method did not take daylight savings time into account. The next example works for me:
#Set Default Timezone
$wgLocaltimezone = "Europe/Amsterdam";

#Calculate the timezone offset with UTC
$oldtz = getenv("TZ");
putenv("TZ=$wgLocaltimezone");
$wgLocalTZoffset = date("Z") / 3600 + Date("I");
putenv("TZ=$oldtz");

Note: The methods in this section are unconfirmed and may not work properly.