Difference between revisions of "Template:Time"

From WikiMe @ iroiro.io
Jump to: navigation, search
ink>Heddy
(specified UTC in documentation)
ink>Heddy
(revised documentation)
Line 1: Line 1:
<includeonly>[https://www.timeanddate.com/worldclock/fixedtime.html?iso={{#time: Ymd"T"His | {{{1}}} }} {{#time: H:i e | {{{1}}} }}]</includeonly><noinclude>
+
<includeonly>[https://www.timeanddate.com/worldclock/fixedtime.html?iso={{#time: Ymd"T"His | {{{1|}}} }} {{#time: H:i e | {{{1|}}} }}]</includeonly><noinclude>
 
This template is used to keep time formatted consistently across the wiki.
 
This template is used to keep time formatted consistently across the wiki.
 +
 +
It converts time input to [[wikipedia:Coordinated Universal Time|Coordinated Universal Time (UTC)]] and displays a link to a time conversion service for users to click and see when an event happened in their local time zone.
 +
 +
Complete documentation of the #time parser function that this template uses can be found at [[mw:Help:Extension:ParserFunctions|Help:Extension:ParserFunctions]].
  
 
== Usage ==
 
== Usage ==
Enter time in the format: '''hh:mm UTC'''.
+
Enter time in the format: '''yyyy-mm-dd hh:mm time zone'''.
: For example, the current time is '''{{#time: H }}:{{#time: i }} UTC'''. You would type <code><nowiki>{{time|</nowiki>{{#time: H }}:{{#time: i }} <nowiki>UTC}}</nowiki></code>.
+
: The time '''{{#time: Y-m-d H:i e }}''' is entered as <code><nowiki>{{time|</nowiki>{{#time: Y-m-d H:i e }}<nowiki>}}</nowiki></code>.
 +
 
 +
The template will convert non-UTC input to UTC.
 +
: <code><nowiki>{{time|2018-01-13 15:00 JST}}</nowiki></code> will be converted to {{time|2018-01-13 15:00 JST}}.
 +
 
 +
The template alone will display the current time. The time will not be accurate unless the page cache was refreshed recently.
 +
: Entering <code><nowiki>{{time}}</nowiki></code> results in {{time}}.
 +
 
 +
If the date is not needed, time can be entered alone. The resulting link will assume today's date.
 +
: '''{{#time: H:i e }}''' is entered as <code><nowiki>{{time|</nowiki>{{#time: H:i e }}<nowiki>}}</nowiki></code>.
  
If a time zone is provided, the time will be converted to the UTC time standard. If a date is included, only the time will be displayed.
+
Relative time is accepted.
: For example, <code><nowiki>{{time|2018-01-13 15:00 JST}}</nowiki></code> will be converted to {{time|2018-01-13 15:00 JST}}.
+
: If {{#time: Y-m-d H:i e}} were the current time, entering <code><nowiki>{{time|+2 hours}}</nowiki></code> would result in {{time|+2 hours}}.
 
[[Category:Formatting Templates]]
 
[[Category:Formatting Templates]]
 
</noinclude>
 
</noinclude>

Revision as of 23:53, 27 August 2018

This template is used to keep time formatted consistently across the wiki.

It converts time input to Coordinated Universal Time (UTC) and displays a link to a time conversion service for users to click and see when an event happened in their local time zone.

Complete documentation of the #time parser function that this template uses can be found at Help:Extension:ParserFunctions.

Usage

Enter time in the format: yyyy-mm-dd hh:mm time zone.

The time 2025-12-22 09:56 UTC is entered as {{time|2025-12-22 09:56 UTC}}.

The template will convert non-UTC input to UTC.

{{time|2018-01-13 15:00 JST}} will be converted to 06:00 UTC.

The template alone will display the current time. The time will not be accurate unless the page cache was refreshed recently.

Entering {{time}} results in 09:56 UTC.

If the date is not needed, time can be entered alone. The resulting link will assume today's date.

09:56 UTC is entered as {{time|09:56 UTC}}.

Relative time is accepted.

If 2025-12-22 09:56 UTC were the current time, entering {{time|+2 hours}} would result in 11:56 UTC.