Template:Format time/sandbox

From blackwiki
Jump to navigation Jump to search
Template documentation[view] [edit] [history] [purge]

Syntax

Parameters

  • {{{hour}}} is required, and is the hour in 24 hour format.
    • aliases: {{{hh}}} and {{{1}}} (the first positional parameter)
  • {{{minute}}} is recommended; it is the minute after the hour (default 0).
    • aliases: {{{mm}}} and {{{2}}} (the second positional parameter)
  • {{{second}}} is optional; seconds will only be rendered if this is not blank.
    • aliases: {{{ss}}}, {{{sec}}} and {{{3}}} (the third positional parameter)
  • {{{TimeZone}}} may be a numerical value, or "Z" for UTC; see examples.
    • aliases: {{{timezone}}}, {{{tz}}} and {{{4}}} (the fourth positional parameter)
  • {{{hour_format}}} can be blank, 'h', 'H', 'g' or 'G'; see Script error: No such module "Section link"..

Examples:


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:


See also

[edit] all subsections that follow:

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

Unit of time Adjustable Current Last Next
SECOND {{CURRENTSECOND}}
MINUTE {{CURRENTMINUTE}}
HOUR {{CURRENTHOUR}} {{Hour-1}} {{Hour+1}}
WEEK {{CURRENTWEEK}}
{{CURRENTWEEKOFMONTH}}
Day of Week {{Dow}} {{CURRENTDAYNAME}}
{{CURRENTWEEKDAYABBREV}}
{{CURRENTWEEKDAY}}
{{LASTWEEKDAYNAME}}
{{LASTWEEKDAYABBREV}}
{{NEXTWEEKDAYNAME}}
{{NEXTWEEKDAYABBREV}}
MONTH {{MONTHNAME}}
{{MONTHABBREV}}
{{MONTHNUMBER}}
{{MONTH}} (zero padded)
{{CURRENTMONTHNAME}}
{{CURRENTMONTHABBREV}}
{{CURRENTMONTH1}}
{{CURRENTMONTHDAYS}}
{{LASTMONTH}}
(Can make not zero-padded)
{{LASTMONTHNAME}}
{{LASTMONTHABBR}}
{{NEXTMONTH}}
(Can make not zero-padded)
{{NEXTMONTHNAME}}
{{NEXTMONTHABBR}}
Day of Month {{CURRENTDAY}}
{{CURRENTDAY2}} (zero padded)
YEAR {{CURRENTYEARCC}}
{{CURRENTYEARYY}}
{{CURRENTISOYEAR}}
{{CURRENTYEAR}}
{{LASTYEAR}} {{NEXTYEAR}}
Day of Year {{CURRENTDAYOFYEAR}}
DECADE {{DECADE}} {{CURRENTDECADE}} {{LASTDECADE}} {{NEXTDECADE}}
CENTURY {{CENTURY}} {{CURRENTCENTURY}} {{LASTCENTURY}} {{NEXTCENTURY}}
MILLENNIUM {{MILLENNIUM}} {{Currentmillennium}}

Date and time templates made for substitution:

Month:
{{Lmonth}} produces Jun
{{Nmonth}} produces Aug
{{LastMonth}} produces June 2022
{{NextMonth}} produces August 2022


Individual templates

Categories of 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

Template parameters

ParameterDescriptionTypeStatus
Hourhour hh 1

Hour of the day, in 24 hour format

Example
13
Auto value
Numberrequired
Minuteminute mm 2

minutes after the hour

Example
3
Auto value
0
Numbersuggested
Secondsecond ss sec 3

Seconds after the minute

Numberoptional
Hour formathour_format

Formats hours and whether to render AM/PM or a.m./p.m.

Example
g (7:00 p.m.), G (07:00 PM), h (19:00), or H (19:00)
Stringsuggested
Timezonetimezone tz TimeZone 4

A numerical offset from UTC, or 'Z'. If non-empty, shows time zone

Example
Z
Stringoptional