Jump to content

Template:Format date/doc

From NicheWork
Revision as of 13:42, 19 January 2026 by MarkAHershberger (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Usage

This template ({{Format date}}) returns a date, or date-time, without the hidden version for use in microformats. This template is probably best used internally in other templates.

If you need the microformat support, use template {{Start date}} instead.

If you want sortable dates for a table, use {{Date table sorting}} instead.

Syntax

  • {{Format date|year|month|day}}
  • {{Format date|year|month|day|HH|MM|SS|TimeZone}} (MM and SS are optional; TimeZone may be a numerical value, or "Z" for UTC; see examples)

Examples:

  • {{Format date|1993}} returns "1993"
  • {{Format date|1993|02}} returns "February 1993"
  • {{Format date|1993|02|24}} returns "February 24, 1993"
  • {{Format date|1993|02|24|08|30}} returns "08:30, February 24, 1993"
  • {{Format date|1993|02|24|08|+01:00}} returns "February 24, 1993 (+01:00)"
  • {{Format date|1993|02|24|08|-07:00}} returns "February 24, 1993 (-07:00)"
    {{Format date|1993|02|24|08|30|23}} returns "08:30:23, February 24, 1993"
  • {{Format date|1993|02|24|08|30|23|Z}} returns "08:30:23, February 24, 1993 (UTC)"
  • {{Format date|1993|02|24|08|30|23|+01:00}} returns "08:30:23, February 24, 1993 (+01:00)"
  • {{Format date|1993|02|24|08|30|23|-07:00}} returns "08:30:23, February 24, 1993 (-07:00)"

An optional parameter, df, can be set to "y" or "yes" (or indeed any value) to display the day before the month. This is primarily used in articles about events in parts of the world where the day precedes the month in a date.

Examples:

  • {{Format date|1993|02|24|df=y}} returns "24 February 1993"
  • {{Format date|1993|02|24|08|30|df=yes}} returns "08:30, 24 February 1993"

Note: The template will appear broken when the parameters are left blank (as seen hereinbefore).

See also

  • {{Date}} (an alternative to this template, using a different syntax)
  • {{Start date}} (using the same syntax, but with the support for microformats)
  • {{Start date text}} (an alternative to the template {{Start date}})
  • {{Format time}} for formatting times only

Multiple units of time

Type Adjustable Current Last Next
Date and time
Date only
Month and year only
Time only
  • {{Timeonly}} (Adjustable to 12 h format)
Banners
  • {{Right now}}
    (Blue with time and number of Wikipedia articles)
Timestamp

Single units of time

Unit of time Adjustable Current Last Next
Second
Minute
Hour
Week
Day of Week
Month
Day of Month
Year
Day of Year
Decade
Century
Millenium

Date and time templates made for substitution

Parser functions

Individual templates

Categories of templates

<templatedata> { "params": { "1": { "aliases": [ "year" ], "label": "Year", "description": "The year to render in the date", "example": "1997", "type": "number", "autovalue": "", "suggested": true }, "2": { "aliases": [ "month" ], "label": "Month", "description": "The month to render in the date", "example": "January", "type": "string", "autovalue": "", "suggested": true }, "3": { "aliases": [ "day" ], "label": "Day", "description": "The day of the month to format in the date", "example": "20", "type": "string", "autovalue": "", "suggested": true }, "4": { "aliases": [ "hour", "hh" ], "label": "Hour (HH)", "description": "the hour to format in the date (if desired)", "example": "03", "type": "string", "autovalue": "" }, "5": { "aliases": [ "minute", "mm" ], "label": "Minute (MM)", "description": "The minute to format in the date (if desired)", "example": "21", "type": "string" }, "6": { "aliases": [ "second", "ss", "sec" ], "label": "Second (SS)", "description": "The second to format in the date (if desired)", "example": "10", "type": "string", "autovalue": "" }, "7": { "aliases": [ "timezone", "TimeZone", "tz" ], "label": "Time zone", "description": "A numerical offset from UTC, or 'Z'", "example": "+5", "type": "string" }, "df": { "label": "Day first?", "description": "If 'y' or 'yes', displays the day before the month", "type": "string", "aliases": [ "dayfirst" ] }, "time_joiner": { "label": "Time joiner", "description": "if included, replaces comma in \"