Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules

Search

Donate to XOOPS!

Please select an amount to donate


Do you want your username revealed with your donation?
Yes - List me as a Generous Donor
No - List my donation as from an Anonymous Donor


Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

admin Arabic banner block Christmas comments cumulus DayDawn dhsoft e-Commerce E-Learning Git Google GUI hacks instant-zero jQuery module mygalleries news Nordic Olédrion oxygen PageRank PHP rmcommon security SEO simple-XOOPS Smarty sport tag Theme tutorial wiki WOX xoops XoopsEngine ZendFramework

New Users

Registering user

# 133948

guilhermeans

Welcome to XOOPS!
[Main Page]

Mw:Manual:Timezone

From XOOPS Web Application System

Main Page | Recent changes | Edit this page | Page history | Switch to MediaWiki mode

Printable version | Disclaimers | Privacy policy
Categories: Manual | Configure | Time


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:

<source lang="php">

  1. Set Default Timezone

$wgLocaltimezone = "America/Los_Angeles"; $oldtz = getenv("TZ"); putenv("TZ=$wgLocaltimezone");

  1. Versions before 1.7.0 used $wgLocalTZoffset as hours.
  2. After 1.7.0 offset as minutes

$wgLocalTZoffset = date("Z") / 60; putenv("TZ=$oldtz"); </source>

  • Set the '$wgLocaltimezone' value to the proper value which you can find here. See examples below.

<source lang="php"> $wgLocaltimezone = "Europe/London"; $wgLocaltimezone = "Asia/Taipei"; </source>

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.

Unconfirmed Methods

  • If you just want to use the local time of your PC, you can just add this line in your LocalSettings.php:

<source lang="php">$wgLocalTZoffset = date("Z") / 60;</source>


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

<source lang="php">$wgLocalTZoffset = 13 * 60;</source>


  • This example may also work great

<source lang="php"> $wgLocaltimezone="Europe/Berlin"; $wgLocalTZoffset = +2; </source>

  • In my case the primary method did not take daylight saving time into account. The next example works for me:

<source lang="php">

  1. Set Default Timezone

$wgLocaltimezone = "Europe/Amsterdam";

  1. Calculate the timezone offset with UTC

$oldtz = getenv("TZ"); putenv("TZ=$wgLocaltimezone"); $wgLocalTZoffset = date("Z") / 60 + date("I") * 60; putenv("TZ=$oldtz"); </source>


  • 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.

<source lang="php"> $wgLocaltimezone = "Europe/Amsterdam";

  1. Calculate the timezone offset with UTC

$oldtz = getenv("TZ"); putenv("TZ=$wgLocaltimezone"); $wgLocalTZoffset = date("Z") / 3600; putenv("TZ=$oldtz"); </source> 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.

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 here for details. E.g. use <source lang="php">$wgLocaltimezone = "CET-1CEST-2,M3.5.0/2,M10.5.0/2";</source>

instead of

<source lang="php">$wgLocaltimezone = "Europe/Budapest";</source>

or

<source lang="php">$wgLocaltimezone = "AEST-9,M10.5.0/3,M4.1.0/3";</source>

instead of

<source lang="php">$wgLocaltimezone = "Australia/Sydney";</source>

Template:Languages

Retrieved from "http://xoops.org/modules/mediawiki/index.php/Mw:Manual:Timezone"

This page has been accessed 1,992 times. This page was last modified 07:55, 20 November 2007. Content is available under XOOPS Web Application System.