Template:Format time/sandbox
Jump to navigation
Jump to search
![]() | This is the template sandbox page for Template:Format time (diff). See also the companion subpage for test cases. |
Contents
Syntax
{{Format time|hour|minute|second}}
{{Format time|hour|minute|second|TimeZone}}
Parameters
{{{hour}}}
is required, and is the hour in 24 hour format.- aliases:
{{{hh}}}
and{{{1}}}
(the first positional parameter)
- aliases:
{{{minute}}}
is recommended; it is the minute after the hour (default 0).- aliases:
{{{mm}}}
and{{{2}}}
(the second positional parameter)
- aliases:
{{{second}}}
is optional; seconds will only be rendered if this is not blank.- aliases:
{{{ss}}}
,{{{sec}}}
and{{{3}}}
(the third positional parameter)
- aliases:
{{{TimeZone}}}
may be a numerical value, or "Z" for UTC; see examples.- aliases:
{{{timezone}}}
,{{{tz}}}
and{{{4}}}
(the fourth positional parameter)
- aliases:
{{{hour_format}}}
can be blank, 'h', 'H', 'g' or 'G'; see Script error: No such module "Section link"..
Examples:
{{Format time|08|30}}
returns "08:30"{{Format time|08|30|23}}
returns "08:30:23"
{{Format time|08|30}}
returns "08:30 (UTC)"{{Format time|08|30|23}}
returns "08:30:23 (+01:00)"{{Format time|08|30|23}}
returns "08:30:23 (-07:00)"
Hour format
The hour format parameter {{{hour_format}}}
can be variously 'g', 'G', 'h', or 'H', specifying whether to use 12 hour time with AM/PM (g/G) or 24 hour time (h/H), and whether to truncate (g/h) numbers under 10 or not (G/H).
Examples:
{{Format time|08|30}}
returns "8:30 am"{{Format time|08|30}}
returns "8:30"{{Format time|08|30}}
returns "08:30 AM"{{Format time|08|30}}
returns "08:30"
See also
- {{Format date}} for dates, with times optional
[
] all subsections that follow:![]() | This template does not put a working clock on your page. The clock will not update the time on your screen every minute. Instead, it records the date and time that the page was most recently edited or purged. If you want a clock that constantly updates, then go to Special:Preferences#mw-prefsection-gadgets and enable the Appearance item, "Add a clock to the personal toolbar that displays the current time in UTC and provides a link to purge the current page". |
Multiple units of time
Type | Adjustable | Current | Last | Next |
---|---|---|---|---|
Date and time | {{time}} | {{Currentdate}} (MDY) {{Plain now}} (DMY) {{Now}} (DMY in a complete sentence) {{Simple now}} |
||
Date only | {{Dateonly}} {{Datedow}} (Has the day of the week) |
{{Date}} (Chose format) {{DATE}} (prefixed by date=) {{TODAY}} (DMY) |
{{Yesterday}} {{Day-1}} |
{{Tomorrow}} {{Day+1}} |
Time only | {{Timeonly}} | {{CURRENTTIME}} (12 h format) {{CURRENTTIME24}} (24 h format) |
||
Banners | {{Right now}} (Blue with time and number of Wikipedia articles) |
|||
Timestamp | {{Timestamp}} (Format YYYYMMDDhhmmss) |
Single units of time
Date and time templates made for substitution:
Month:
{{Lmonth}} produces Jun
{{Nmonth}} produces Aug
{{LastMonth}} produces June 2022
{{NextMonth}} produces August 2022
Individual templates
- {{Calendar}}
- {{Calendar clock with Wikipedia stats}}
- {{Clock}}
- {{Digital clock}}
- {{Digital clock and date}}
Categories of templates
- Category:Time, date and calendar templates
- Category:Date-computing templates
- Category:Date-computing templates based on current time
- Category:ISO date templates
- Category:Calendar templates
Template Data
This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.
TemplateData for Format time
Formats a time of day
Parameter | Description | Type | Status | |
---|---|---|---|---|
Hour | hour hh 1 | Hour of the day, in 24 hour format
| Number | required |
Minute | minute mm 2 | minutes after the hour
| Number | suggested |
Second | second ss sec 3 | Seconds after the minute | Number | optional |
Hour format | hour_format | Formats hours and whether to render AM/PM or a.m./p.m.
| String | suggested |
Timezone | timezone tz TimeZone 4 | A numerical offset from UTC, or 'Z'. If non-empty, shows time zone
| String | optional |
The above documentation is transcluded from Template:Format time/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. Please add categories to the /doc subpage. Subpages of this template. |