Extension:TimeConvert

MediaWiki extensions manual
TimeConvert
Release status: unmaintained
Implementation Parser function
Description Provides a parser function and Scribunto Lua library to convert a time to a different time zone
Author(s) dlhtalk
MediaWiki 1.18+
PHP 5.2+
Database changes No
License MIT License
Download
README

The TimeConvert extension provides a parser function and Scribunto Lua library to convert a time to a different time zone.

Examples

edit
{{#timeconvert:2014-01-01 13:00 GMT|America/New_York}}       => 2014-01-01T08:00:00-0500
{{#timeconvert:2014-01-01 13:00 GMT|America/New_York|g:i A}} => 8:00 AM
{{#timeconvert:2014-01-01 8:00 AM EST|Etc/GMT|G:i}}          => 13:00

Documentation

edit
{{#timeconvert:date time|time zone|format}}

Scribunto Lua Library

edit

TimeConvert provides a Scribunto library, mw.ext.timeconvert. Examples:

local timeconvert = mw.ext.timeconvert.timeconvert
timeconvert("2014-01-01 13:00 GMT", "America/New_York")          => "2014-01-01T08:00:00-0500"
timeconvert("2014-01-01 13:00 GMT", "America/New_York", "g:i A") => "8:00 AM"
timeconvert("2014-01-01 8:00 AM EST", "Etc/GMT", "G:i")          => "13:00"

Installation

edit
  • Download and place the file(s) in a directory called TimeConvert in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    require_once "$IP/extensions/TimeConvert/TimeConvert.php";
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.