Extension:TimeConvert

From Linux Web Expert

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
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').

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

Examples

{{#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

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

Scribunto Lua Library

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

  • <translate> <tvar name=1>Download</tvar> and place the file(s) in a directory called <tvar name=name>TimeConvert</tvar> in your <tvar name=ext>extensions/</tvar> folder.</translate>
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    require_once "$IP/extensions/TimeConvert/TimeConvert.php";
    
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>