• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:Format date

  • Template
  • Talk
  • Language
  • Watch
  • View source
Template documentation[view] [edit] [history] [purge]

Contents

  • 1 Usage
  • 2 Syntax
  • 3 See also
    • 3.1 Multiple units of time
    • 3.2 Single units of time
    • 3.3 Date and time templates made for substitution:
      • 3.3.1 Parser functions
      • 3.3.2 Individual templates
      • 3.3.3 Categories of templates

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
For the magic words with the same or similar names, see MediaWikiWiki:Help:Magic words § Date and time.
  • v
  • t
  • e

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)
{{TODAY}} (DMY)
{{Yesterday}}
{{Day-1}}
{{Tomorrow}}
{{Day+1}}
Month and year only {{Monthyear}}

{{DATE}} (prefixed by date=)

{{Monthyear-1}} {{Monthyear+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}}
Week {{CURRENTWEEK}}
{{CURRENTWEEKOFMONTH}}
Day of Week {{DAYOFWEEK}} {{CURRENTDAYNAME}}
{{CURRENTWEEKDAYABBREV}}
{{CURRENTWEEKDAY}}
Month {{MONTHNAME}}
{{MONTHABBREV}}
{{MONTHNUMBER}}
{{MONTH}} (zero padded)
{{CURRENTMONTHNAME}}
{{CURRENTMONTHABBREV}}
{{CURRENTMONTH1}}
{{CURRENTMONTHDAYS}}
{{LASTMONTHNAME}} {{NEXTMONTHNAME}}
Day of Month {{CURRENTDAY}}
{{CURRENTDAY2}} (zero padded)
Year {{CURRENTYEARCC}}
{{CURRENTYEARYY}}
{{CURRENTISOYEAR}}
{{CURRENTYEAR}}
{{LASTYEAR}} {{NEXTYEAR}}
Day of Year {{CURRENTDAYOFYEAR}}
Decade {{DECADE}} {{CURRENTDECADE}}
Century {{Century}} {{CURRENTCENTURY}}
MILLENNIUM {{MILLENNIUM}}

Date and time templates made for substitution:

Month:
{{Lmonth}} produces Jul
{{Nmonth}} produces Sep
{{Last month}} produces July 2025
{{Next month}} produces September 2025


Parser functions

  • mw:Special:MyLanguage/time permits a custom time specifier string, similar to the C date and time functions

Individual templates

  • {{Calendar}}
  • {{Calendar clock with Wikipedia stats}}
  • {{Clock}}
  • {{Digital clock}}
  • {{Digital clock and date}}
  • {{Infobox calendar date today}}
  • {{Raph Williams65/digiclock}}

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

No description.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Year1 year

The year to render in the date

Example
1997
Auto value
Numbersuggested
Month2 month

The month to render in the date

Example
January
Auto value
Stringsuggested
Day3 day

The day of the month to format in the date

Example
20
Auto value
Stringsuggested
Hour (HH)4 hour hh

the hour to format in the date (if desired)

Example
03
Auto value
Stringoptional
Minute (MM)5 minute mm

The minute to format in the date (if desired)

Example
21
Stringoptional
Second (SS)6 second ss sec

The second to format in the date (if desired)

Example
10
Auto value
Stringoptional
Time zone7 timezone TimeZone tz

A numerical offset from UTC, or 'Z'

Example
+5
Stringoptional
Day first?df dayfirst

If 'y' or 'yes', displays the day before the month

Stringoptional
Time joinertime_joiner

if included, replaces comma in "<time>, <date>" with the value given

Example
on
Stringoptional
Hour formathour_format

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

Example
g (7 ... p.m.), G (07 ... PM), h (19), or H (19)
Stringoptional
The above documentation is transcluded from Template:Format date/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Format_date&oldid=1049415231"
Last edited on 11 October 2021, at 18:22

Languages

    • العربية
    • অসমীয়া
    • भोजपुरी
    • الدارجة
    • فارسی
    • 한국어
    • Հայերեն
    • Bahasa Indonesia
    • Italiano
    • Latina
    • Македонски
    • മലയാളം
    • मराठी
    • Bahasa Melayu
    • မြန်မာဘာသာ
    • 日本語
    • Нохчийн
    • Scots
    • Shqip
    • Sicilianu
    • සිංහල
    • Simple English
    • Српски / srpski
    • தமிழ்
    • తెలుగు
    • Українська
    • اردو
    • Vèneto
    • Tiếng Việt
    • 粵語
    • 中文
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 11 October 2021, at 18:22 (UTC).
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikipedia
    • Disclaimers
    • Contact Wikipedia
    • Code of Conduct
    • Developers
    • Statistics
    • Cookie statement
    • Terms of Use
    • Desktop