Open main menu

Extension:TimeZoneInfo

MediaWiki extensions manual
OOjs UI icon advanced.svg
TimeZoneInfo
Release status: stable
TimeZoneInfo extension example.jpg
Implementation Tag
Description Displays several types of information relating to timezones.
Author(s) JohanTheGhost
Latest version 1.0
License No license specified
Download Version 1.0
Translate the TimeZoneInfo extension if it is available at translatewiki.net
Check usage and version matrix.

What can this extension do?Edit

This extension displays several types of useful (?) information relating to timezones. It is expected to be of some use in Wikis which serve a distributed community of users, where people want to know what time it is for other people.

UsageEdit

The extension creates three new tags:

  • <tzchart> creates a timezone conversion chart
  • <tztrans> displays standard <--> daylight time transitions
  • <tzlist> produces a table of all known timezones

Time Zone ChartEdit

The <tzchart> tag creates a conversion chart showing the relationships between a number of specified timezones. Timezones with fractional hour offsets (eg. India) are handled quite well.

The tag takes the following parameters:

align=<table-alignment>
passed to the generated table
start=<hour>
start the chart at the given UTC hour; default 0 (midnight UTC).

The tag text consists of the timezone list, one name per line. Each name may be followed by a user-friendly label, but this is currently unused.

Example:

<tzchart align=right start=2>
America/Los_Angeles
Europe/Paris
Asia/Calcutta
</tzchart>

Time Zone TransitionsEdit

The <tztrans> tag displays a table of standard <--> daylight time transitions for a number of specified timezones, making it easy to see when people in other countries will be changing their clocks.

The tag takes the following parameters:

align=<table-alignment>
passed to the generated table

The tag text consists of the timezone list, one name per line. Each name may be followed by a user-friendly label, which will be used in place of the zone name if supplied.

Example:

<tztrans align=right>
America/Los_Angeles LA
Europe/Paris Paris
Asia/Calcutta India
</tztrans >

Time Zone ListEdit

The <tzlist> tag produces a table of all known timezones, or zones whose names match a specified filter.

The tag takes the following parameters:

filter=<filter-text>
if supplied, only zones whose name contains the given string are shown.

Any text enclosed within the tag is ignored.

Example:

<tzlist filter="Atlantic/" />

InstallationEdit

  1. Download the extension code:
    • Version 1.0: known to work with PHP 5 and MW 1.9; may work on PHP 4.
  2. Save the code in your wiki's extensions directory as extensions/TimeZoneInfo.php.

Changes to LocalSettings.phpEdit

require_once("$IP/extensions/TimeZoneInfo.php");