defzone.net@gmail.comLiên hệ
DZ
DefZone.Net

Kien thuc cong nghe & giai tri

Bai vietDia diemAlbum anhGameCua hang
  1. Home
  2. Wiki
Template documentation[view] [edit] [history] [purge]
For the #time parser function, see #time.
This template uses Lua:
  • Module:Time (sandbox)
  • Module:Time/data (sandbox)

This template displays the current time in a parameter-specified time zone. The time is calculated based on the offset from UTC for the specified time zone taking into account whether daylight saving time is currently active in that time zone.

Note: Most Wikipedia pages display a cached version of the page to reduce server load, so the template will only display the current time as of when the page was last parsed. You can refresh the displayed time by clicking the [refresh] link.

Parameters

[edit]

{{time}} supports two positional and several named parameters; none are required:

|<time zone> – the first positional (unnamed) parameter, specifies the time zone for which the template is to provide a time output. If omitted, the template displays UTC time. A time zone is identified by an abbreviation of the time zone's standard-time name. Do not use a summertime or daylight saving time abbreviation; they will be ignored and produce an error message.
|<df> – the positional (unnamed) version of |df= which see
|df= – date format; this parameter takes one of several values; values other than these are ignored:
|df=dmy – specifies day month year date format; time in 24-hour format; alias: |df=dmy24
07:58, 29 December 2025 MST [refresh]
|df=dmy12 – same as |df=dmy except time in 12-hour am/pm format
7:58 am, 29 December 2025 MST [refresh]
|df=mdy – specifies month day, year format; time in 24-hour format; default when a date format is not specified in the time zone's properties; alias: |df=mdy24
07:58, December 29, 2025 MST [refresh]
|df=mdy12 – same as |df=mdy except time in 12-hour am/pm format
7:58 am, December 29, 2025 MST [refresh]
|df=iso – renders the date/time in a form roughly adhering to the ISO 8601 format (seconds omitted)
2025-12-29T07:58 MST [refresh]
|df=y – legacy {{time}} parameter, same as |df=dmy
|df=12 – time-only display 12-hour am/pm format
7:58 am MST [refresh]
|df=24 – time-only display 24-hour format
07:58 MST [refresh]
|df-cust= – custom time/date formats using the codes defined at mw:Help:Extension:ParserFunctions##time; yields to |df=
|df-cust-a= – custom time/date formats as above specifically for ante meridiem time; requires |df-cust-p=; yields to |df-cust=
|df-cust-p= – custom time/date formats as above specifically for post meridiem time; requires |df-cust-a=; yields to |df-cust=
|dst= – custom daylight saving adjustment
|dst=no – disables the daylight saving time adjustment for the time zone; useful for locations within a time zone that do not observe daylight saving time; Arizona, for example
|dst=always – adjusts to daylight saving time regardless of normal time zone daylight saving adjustments; ignored when the specified timezone does not observe daylight saving time
|lang=<code> – displays time/date in language specified by ISO 639 language <code>
these parameters take only the value yes:
|dateonly= – suppresses time display
|timeonly= – suppresses date display
|hide-refresh= – suppresses the refresh link
|hide-tz= – suppresses the timezone abbreviation
|unlink-tz= – renders unlinked timezone abbreviation
|_TEST_TIME_= – a parameter that was useful during the development of the template's code. The value assigned to this parameter must either be in ISO 8601 format without time zone designator (2025-12-29T14:58:27), or YYYYMMDDhhmmss format as output by {{Timestamp}} (20251229145827). This is interpreted by the template as UTC.

Usage

[edit]

Typically, all that is needed is:

{{time|<TZ>}} where <TZ> is one of the supported time zone abbreviations
{{time|MST}}
07:58, December 29, 2025 MST [refresh]

To change the rendered format:

{{time|MST|df=y}}
07:58, 29 December 2025 MST [refresh]
{{time|MST|y}}
07:58, 29 December 2025 MST [refresh]
{{time|MST|dmy}}
07:58, 29 December 2025 MST [refresh]
{{time|MST|iso}}
2025-12-29T07:58 MST [refresh]

Supported time zones

[edit]

This is a list of the currently supported time zone abbreviations:

  • ACST (ACDT)
  • AEST (AEDT)
  • AKT (AKST) (AKDT)
  • AoETooltip Anywhere on Earth[A]
  • AT (AST) (ADT)
  • AWST
  • BST
  • BT
  • CET (CEST)
  • ChST
  • CT (CST) (CDT)
  • EET (EEST)
  • ET (EST) (EDT)
  • GFT
  • GMT
  • GMT-IE[B]
  • GMT-UK[C]
  • HST (HDT)
  • IDLE[A]
  • IDLW[A]
  • ILST[B]
  • IRKT
  • IRST
  • IST[B]
  • JST
  • KALT (USZ1)
  • KPT[D]
  • KRAT
  • KST
  • KZT
  • MAGT
  • MMT
  • MSK
  • MST (MDT)
  • MVT
  • MYT
  • NPT
  • NST (NDT)
  • NZST (NZDT)
  • OMST
  • PETT
  • PHT
  • PKT
  • PMST (PMDT)
  • PT (PST) (PDT)
  • SAMT
  • SAST
  • SLST
  • SRET
  • SST
  • UTC
  • VLAT
  • WET (WEST)
  • WGT (WGST)
  • WIB
  • WIT
  • WITA
  • YAKT
  • YEKT
  1. ^ a b c Nonstandard time zone included for convenience.
  2. ^ a b c To differentiate between multiple time zones abbreviated as IST, the template uses IST for Indian Standard Time, GMT-IE for Irish Standard Time, and ILST for Israel Standard Time/Summer Time.
  3. ^ To differentiate between Bangladesh Standard Time (BST) and year-round GMT, the template uses GMT-UK for the United Kingdom.
  4. ^ To differentiate between Paraguay Time (PYT), the template uses KPT for Pyongyang Time.

UTC offset

[edit]

To display the time at a particular UTC offset, specify the UTC time offset as the time zone:

{{time|UTC-07:00}}
2025-12-29T07:58 UTC−07:00 [refresh]

'UTC', a sign character, two hour digits, a colon, and two minute digits are required. Accepted sign characters are: '+', '-' (hyphen), '±', and '−' (minus).

Military/nautical time zones

[edit]

To display the time at a particular military or nautical time zone,[1] use the time zone's alpha designation:

{{time|M}}
2025-12-30T02:58 M [refresh]

Some military and nautical time zone designators are extended with an asterisk (*), a dagger (†), or double dagger (‡). When writing this template for designators that are extended with a dagger or double dagger, use '+' and '++' respectively:

{{time|M++}}
2025-12-30T03:43 M‡ [refresh]
{{time|M+}}
2025-12-30T04:58 M† [refresh]

Daylight saving time

[edit]

Daylight saving time (DST) calculations are automatic for those time zones where it is observed. There are locales that do not observe DST within time zones where it is generally observed. To render the correct time for a non-observant locale, set |dst=no:

{{time|MST|dst=no}}
07:58, December 29, 2025 MST [refresh] – time in Arizona
{{time|MST}}
07:58, December 29, 2025 MST [refresh] – but, time on the Navajo Nation in Arizona

The opposite case, for locales that always observe a 1-hour DST, set |dst=always:

{{time|MST|dst=always}}
08:58, December 29, 2025 MDT [refresh] – MDT, always, but until a change in federal law in United States Congress daylight saving time observed permanently is illegal.

|dst=always is ignored when the timezone does not observe daylight saving time:

{{time|JST}}
2025-12-29T23:58 JST [refresh] – time in Japan
{{time|JST|dst=always}}
2025-12-29T23:58 JST [refresh]
{{time|UTC+01:00|dst=always}}
2025-12-29T15:58 UTC+01:00 [refresh]

For places like Thule Air Base in Greenland, which observes US DST rules while WGT observes EU DST rules, a time zone properties table will be needed in Module:Time. See §Adding a new time zone.

If DST is not in effect for that time zone for an example, set |dst=yes as it's not a valid parameter and will be disabled and will display the standard time calculation instead as standard time is in effect at that time of year.

{{time|EDT|dst=yes|_TEST_TIME_=2020-01-01T04:59:59}}
23:59, December 31, 2019 EST [refresh] (expected 00:59, January 1, 2020 EDT [refresh]) due to the fact that DST is in not in effect in this zone at this time of year.

Error messages

[edit]

{{time}} can produce several error messages. These are:

{{time}} – both of |df-cust-a= and |df-cust-p required – when defining a custom format for am (or pm) time, you must also define a custom format for pm (or am) time
{{time}} – error calculating dst timestamps – indicates an internal error because one or more of the following time zone properties is malformed: UTC offset, DST begin or end definition. To resolve this error make sure that the time zone's properties are correct.
{{time}} – incomplete definition for ... – indicates an internal error because one or more of the following time zone properties is missing: DST begin or end definition, DST event time, time zone article. To resolve this error supply the missing properties.
{{time}} – invalid date format <format> – value assigned to |df= is not one of the defined format strings; ss §Parameters
{{time}} – invalid use of ± - the symbol ± is being used when the minute and hour offsets aren't 00:00
{{time}} – malformed or incomplete _TEST_TIME_ – value assigned to this parameter must either have the format: YYYY-MM-DDThh:mm:ss where all except 'T' are digits, or YYYYMMDDhhmmss
{{time}} – unknown timezone – the time zone positional parameter is not one of the supported time zone abbreviations. To resolve this error check the parameter's spelling or add the time zone's properties to the module. See §Adding a new time zone.

Adding a new time zone

[edit]

{{time}} uses Module:Time/data. In that module, is a table of tables, the data structure that specifies the properties of the individual time zones. A blank time zone properties table has this form:

[''] = {
	abbr = '',			
	dst_abbr = '',
	utc_offset = '',
	df = '',
	dst_begins = '',
	dst_ends = '',
	dst_time = '',
	dst_e_time = '',
	article = ''
},

To add a new time zone to Module:Time/data, add the appropriate information inside the single quotes. If a property does not apply, leave the quotes empty. The rules for each property are:

[''] – (required) the abbreviation of a time zone's standard time; must be lower case; this is the value that will be used in the template's time zone parameter
abbr = '' – (required) the abbreviation of a time zone's standard time as it will be rendered by the template
dst_abbr = '' – the abbreviation of a time zone's daylight saving or summer time as it will be rendered by the template
utc_offset = '' – (required) the offset in hours and minutes from UTC+00:00; has the form: utc_offset = '<sign>hh:mm' where <sign> may be + (optional) or - (required for time zones west of the 0 meridian)
df = '' – one of three keywords dmy, mdy, or iso used to specify date format typically used in the time zone; can be overridden with |df= template parameter
dst_begins = '' – a four word sentence in the form <ordinal> <day name> <in|of> <month name> where:
<ordinal> – any of the words 'first', '1st', 'second', '2nd', ... 'fifth', '5th', or 'last'
<day name> – any of the day names 'Sunday', 'Monday', 'Tuesday', etc.; capitalization is not important but otherwise must be spelled correctly; abbreviations not supported
<in|of> – either of the words 'in' or 'of'
<month name> – any of the month names 'January', 'February', 'March', etc.; capitalization is not important but otherwise must be spelled correctly; abbreviations not supported
dst_ends = '' – (required if dst_begins is specified) same as dst_begins
dst_time = '' – (required if dst_begins is specified) the time that daylight saving time begins; usually local time; when DST begins at a specified time UTC (European Summer Time for example) use: dst_time = 'hh:mm UTC'; four digits and the colon are required
dst_e_time = '' – the time that daylight saving time ends if different from the time it begins; usually local daylight saving time ; when DST ends at a specified time UTC use: dst_e_time = 'hh:mm UTC'; four digits and the colon are required
article = '' – (required) the title of a Wikipedia article that is appropriate to the timezone; do not include wikimarkup

The table-of-tables is organized east (plus UTC offsets) then west (minus UTC offset), by offset hours, and then alphabetically by time zone positional parameter name.

Adding a new alias

[edit]

You may also want to add an alias of a timezone:

[''] = {tz = ''},

To add a new time zone to Module:Time/data, add the appropriate information inside the single quotes.

[''] – (required) the abbreviation of a time zone's alias. This must be lower case.
tz = '' – (required) the abbreviation of the time zone that's already in the code. This must be lower case

The table-of-tables is organized east (plus UTC offsets) then west (minus UTC offset), and by if it's a DST offset or if it's not.

See also

[edit]
For the magic words with the same or similar names, see MediaWikiWiki:Help:Magic words § Date and time.
  • v

Multiple units of time

[edit]
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

[edit]
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 {{CURRENTYEAR}}
{{CURRENTYEARCC}}
{{CURRENTYEARYY}}
{{CURRENTISOYEAR}}
{{LASTYEAR}} {{NEXTYEAR}}
Day of Year {{CURRENTDAYOFYEAR}}
Decade {{DECADE}} {{CURRENTDECADE}}
Century {{Century}} {{CURRENTCENTURY}}
MILLENNIUM {{MILLENNIUM}}

Date and time templates made for substitution

[edit]
  • {{Last month (short)}} produces Nov
  • {{Next month (short)}} produces Jan
  • {{Last month}} produces November 2025
  • {{Next month}} produces January 2026

Parser functions

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

Individual templates

[edit]
  • {{Calendar}}
  • {{Calendar clock with Wikipedia stats}}
  • {{Clock}}
  • {{Digital clock}}
  • {{Digital clock and date}}
  • {{Infobox calendar date today}}

Categories of templates

[edit]
  • 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

References

[edit]
  1. ^ "World Time Zone Map". HM Nautical Almanac Office. February 2016.

TemplateData

[edit]
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Time in articles based on its TemplateData.

TemplateData for Time

Displays the current time in a parameter-specified time zone.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
time zone1

The time zone for the time formatting

Example
EST
Stringsuggested
date format2 df

The format to render the date and time

Suggested values
dmy dmy12 mdy mdy12 iso y 12 24
Unknownsuggested
Daylight savings timedst

no description

Suggested values
yes no always
Stringoptional
ISO 639 language codelang

displays time/date in language specified by ISO 639 language

Stringoptional
dateonlydateonly

If 'yes', suppresses display of the time and only shows the date

Suggested values
yes
Stringoptional
timeonlytimeonly

If 'yes', suppresses display of the date and only shows the time

Suggested values
yes
Stringoptional
Hide time zone?hide-tz

If 'yes', suppresses time zone abbreviation

Suggested values
yes
Stringoptional
Don't link time zone?unlink-tz

If 'yes', renders the timezone without linking to its article.

Suggested values
yes
Stringoptional
Hide the [refresh] link?hide-refresh

If 'yes', suppresses the [refresh] link.

Suggested values
yes
Stringoptional
Custom time/date formatdf-cust

Custom time/date format using the codes defined for {{#time:}}

Example
d/m/Y
Stringoptional
Custom time/date format for ante meridiem timedf-cust-a

Custom time/date format specifically for ante meridiem time, using the codes defined for {{#time:}}; requires |df-cust-p=

Example
g:i "a.m."
Stringoptional
Custom time/date format for post meridiem timedf-cust-p

Custom time/date format specifically for post meridiem time, using the codes defined for {{#time:}}; requires |df-cust-a=

Example
g:i "p.m."
Stringoptional
The above documentation is transcluded from Template:Time/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.
DZ
DefZone.Net

Noi chia se kien thuc, huong dan va kham pha cong nghe.

Lien ket nhanh

Trang chủBài viếtWikiCửa hàngLiên hệ

Liên hệ

Email: defzone.net@gmail.com
Điện thoại: +84 762 559 696
Địa chỉ: Thiên Hương, Thủy Nguyên, Hải Phòng

Đăng ký nhận tin

Nhận bài viết và cập nhật mới nhất qua email.

© 2025 DefZone.Net. All rights reserved.
PrivacyTermsSitemap