Extension:TimeConvert
This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored. |
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 | GitHub: Note: 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}}
date time
: A date time string.time zone
: The time zone to convertdate time
to.format
: The output format to use. The default is ISO 8601.
Scribunto Lua Library
editTimeConvert 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 yourextensions/
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.