Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
NowMusic Wiki
Search
Search
Appearance
Donate
Create account
Log in
Personal tools
Donate
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Template:Time ago/doc
Template
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Preview
Advanced
Special characters
Help
Heading
Level 2
Level 3
Level 4
Level 5
Format
Insert
Latin
Latin extended
IPA
Symbols
Greek
Greek extended
Cyrillic
Arabic
Arabic extended
Hebrew
Bangla
Tamil
Telugu
Sinhala
Devanagari
Gujarati
Thai
Lao
Khmer
Canadian Aboriginal
Runes
Á
á
À
à
Â
â
Ä
ä
Ã
ã
Ǎ
ǎ
Ā
ā
Ă
ă
Ą
ą
Å
å
Ć
ć
Ĉ
ĉ
Ç
ç
Č
č
Ċ
ċ
Đ
đ
Ď
ď
É
é
È
è
Ê
ê
Ë
ë
Ě
ě
Ē
ē
Ĕ
ĕ
Ė
ė
Ę
ę
Ĝ
ĝ
Ģ
ģ
Ğ
ğ
Ġ
ġ
Ĥ
ĥ
Ħ
ħ
Í
í
Ì
ì
Î
î
Ï
ï
Ĩ
ĩ
Ǐ
ǐ
Ī
ī
Ĭ
ĭ
İ
ı
Į
į
Ĵ
ĵ
Ķ
ķ
Ĺ
ĺ
Ļ
ļ
Ľ
ľ
Ł
ł
Ń
ń
Ñ
ñ
Ņ
ņ
Ň
ň
Ó
ó
Ò
ò
Ô
ô
Ö
ö
Õ
õ
Ǒ
ǒ
Ō
ō
Ŏ
ŏ
Ǫ
ǫ
Ő
ő
Ŕ
ŕ
Ŗ
ŗ
Ř
ř
Ś
ś
Ŝ
ŝ
Ş
ş
Š
š
Ș
ș
Ț
ț
Ť
ť
Ú
ú
Ù
ù
Û
û
Ü
ü
Ũ
ũ
Ů
ů
Ǔ
ǔ
Ū
ū
ǖ
ǘ
ǚ
ǜ
Ŭ
ŭ
Ų
ų
Ű
ű
Ŵ
ŵ
Ý
ý
Ŷ
ŷ
Ÿ
ÿ
Ȳ
ȳ
Ź
ź
Ž
ž
Ż
ż
Æ
æ
Ǣ
ǣ
Ø
ø
Œ
œ
ß
Ð
ð
Þ
þ
Ə
ə
Formatting
Links
Headings
Lists
Files
Discussion
References
Description
What you type
What you get
Italic
''Italic text''
Italic text
Bold
'''Bold text'''
Bold text
Bold & italic
'''''Bold & italic text'''''
Bold & italic text
Description
What you type
What you get
Reference
Page text.<ref>[https://www.example.org/ Link text], additional text.</ref>
Page text.
[1]
Named reference
Page text.<ref name="test">[https://www.example.org/ Link text]</ref>
Page text.
[2]
Additional use of the same reference
Page text.<ref name="test" />
Page text.
[2]
Display references
<references />
↑
Link text
, additional text.
↑
Link text
{{Documentation subpage}} {{lua|Module:Time ago}} <!-- Categories go at the bottom of this page and interwikis go in Wikidata. --> The '''Time ago''' template calculates the amount of time which has passed since a provided timestamp. The result is a string similar to one of the examples below. This template ''should not'' be used with "subst" unless you don't want the stamp to change as the user refreshes the page. Note that due to Wikipedia's caching mechanisms, you may need to [[WP:PURGE|purge]] a page using this template to update the dynamic value. See the section [[#Purge|Purge]] below. The result is rounded down. "Month" is defined as 31 days. == Usage == * <code><nowiki>{{</nowiki>'''Time ago'''|''timestamp''<nowiki>}}</nowiki></code> The timestamp can be almost any solid, readable format but to avoid ambiguity mistakes, one of the styles below is preferred. * <code>magnitude</code> parameter can be set to explicitly use certain unit. Allowed values are: <code>seconds</code>, <code>minutes</code>, <code>hours</code>, <code>days</code>, <code>weeks</code>, <code>months</code> and <code>years</code>. * <code>min_magnitude</code> parameter can be set to use the specified unit or bigger units. Allowed values are: <code>seconds</code>, <code>minutes</code>, <code>hours</code>, <code>days</code>, <code>months</code> and <code>years</code>. * <code>ago</code> parameter can be set to override the default usage of the text "<code>ago</code>". If the parameter is blank but not missing (i.e. <code><nowiki>{{time ago|2008|ago=}}</nowiki></code>), then the text "ago" is suppressed altogether. For future dates, setting "ago" as blank but not missing will suppress the text "time" (i.e. "2 years" instead of "2 years' time"). === Spelling out numbers === Numbers from 1 to 100 can be spelled out in their equivalent English word by using the <code>spellout</code> parameter. If <code>spellout</code> is set to "yes", "y", "true" or "1", all numbers from 1 to 100 will be spelled out. If <code>spellout</code> is set to "auto", only numbers from 1 to 9 will be spelled out, as per the recommendations at [[MOS:NUMERAL]]. It is also possible to set a custom maximum value for spelling out by using the <code>spelloutmax</code> parameter. For example, setting {{para|spellout|yes}} and {{para|spelloutmax|24}} will result in all numbers less than or equal to 24 being spelled out, and all numbers greater than 24 appearing as numerals. === Numeric output === Add {{para|numeric|y}} to print the number only (no text). === Purge link === Add the parameter {{para|purge|yes}} to add a [[WP:PURGE|purge]] link. == Examples == * {{tlc|Time ago| -83 minutes}} → '''{{Time ago|-83 minutes}}''' * {{tlc|Time ago| -334 minutes}} → '''{{Time ago|-334 minutes}}''' * {{tlc|Time ago| +334 minutes}} → '''{{Time ago|+334 minutes}}''' * {{tlc|Time ago|<nowiki>{{REVISIONTIMESTAMP}}</nowiki>}} → '''{{Time ago|{{REVISIONTIMESTAMP}}}}''' * {{tlc|Time ago| Jan 21, 2001 3:45 PM}} → '''{{Time ago|Jan 21 2001 3:45 PM}}''' * ''Wrong:'' {{tlc|Time ago| 3:45 pm, 21 Jan 2001}} → '''{{Time ago|3:45 pm, 21 Jan 2001}}''' * {{tlc|Time ago|20010121154500}} → '''{{Time ago|20010121154500}}''' * {{tlc|Time ago| Nov 6 2008}} → '''{{Time ago|Nov 6 2008}}''' * {{tlc|Time ago| Nov 6 2008|3=magnitude=weeks}} → '''{{Time ago| Nov 6 2008|magnitude=weeks}}''' * {{tlc|Time ago| Nov 6 2008|3=min_magnitude=days}} → '''{{Time ago|Nov 6 2008|min_magnitude=days}}''' * {{tlc|Time ago| Nov 6 2008|3=min_magnitude=years}} → '''{{Time ago|Nov 6 2008|min_magnitude=years}}''' * {{tlc|Time ago| Nov 6 2008|3=ago=in the past}} → '''{{Time ago|Nov 6 2008|ago=in the past}}''' * {{tlc|Time ago| Nov 6 2008|3=purge=yes}} → '''{{Time ago|Nov 6 2008|purge=yes}}''' * {{tlc|Time ago| 2008-11-06}} → '''{{Time ago|2008-11-06}}''' * <code><nowiki>{{Time ago| June 1, 2009|spellout=yes}}</nowiki></code> → '''{{time ago|June 1, 2009|spellout=yes}}''' * <code><nowiki>{{Time ago| June 1, 1999|spellout=yes}}</nowiki></code> → '''{{time ago|June 1, 1999|spellout=yes}}''' * <code><nowiki>{{Time ago| June 1, 2009|spellout=auto}}</nowiki></code> → '''{{time ago|June 1, 2009|spellout=auto}}''' * <code><nowiki>{{Time ago| June 1, 1999|spellout=auto}}</nowiki></code> → '''{{time ago|June 1, 1999|spellout=auto}}''' * <code><nowiki>{{Time ago| June 1, 1989|spellout=yes|spelloutmax=15}}</nowiki></code> → '''{{time ago|June 1, 1989|spellout=yes|spelloutmax=15}}''' * <code><nowiki>{{Time ago| June 1, 1989|spellout=yes|spelloutmax=25}}</nowiki></code> → '''{{time ago|June 1, 1989|spellout=yes|spelloutmax=25}}''' * {{tlc|Time ago|195909}} → '''{{Time ago|195909}}''' * ''Wrong:'' {{tlc|Time ago|196009}} → '''{{Time ago|196009}}''' == TemplateData == <templatedata> { "description": "This template calculates the amount of time which has passed since a provided timestamp.", "params": { "1": { "label": "Timestamp", "description": "Base timestamp for calculation of passed time. Example format: Nov 6 2008, see template documentation for other supported formats.", "type": "string", "required": true }, "magnitude": { "label": "magnitude", "description": "Explicitly sets a specific unit to display return value. Allowed values are: seconds, minutes, hours, days, weeks, months and years.", "type": "string", "required": false }, "min_magnitude": { "label": "min_magnitude", "description": "Sets a minimum unit to display return value. Allowed values are: seconds, minutes, hours, days, months and years.", "type": "string", "required": false }, "ago": { "label": "ago", "description": "Override the default usage of the text 'ago'. If it is blank but not missing then 'ago' will be removed completely; for future dates, this will remove the text 'time' as well.", "type": "string", "required": false }, "purge": { "label": "Purge link", "description": "Add the parameter purge=yes to add a WP:PURGE link.", "type": "string", "required": false }, "spellout": { "type": "string/line", "label": "Spell out numbers", "description": "If set to \"yes\", \"y\", \"true\" or \"1\", numbers from 1 to 100 are spelled out as English words. If set to \"auto\", numbers from 1 to 9 are spelled out." }, "spelloutmax": { "type": "number", "label": "Spell out max", "description": "The maximum number to be spelled out as an English word." } } } </templatedata> <!--== See also == * {{tl|Last edited by}} * {{tl|Years or months ago}} * {{tl|Age}} * {{tl|Start date and age}} * {{tl|Birth date and age}} --> <includeonly>{{Sandbox other|| <!-- Categories go here and interwikis go in Wikidata --> [[Category:Mathematical time and date function templates]] [[Category:Date-computing templates based on current time]] }}</includeonly>
Summary:
Please note that all contributions to NowMusic Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
NowMusic Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template:Documentation subpage
(
edit
)
Template:Lua
(
edit
)
Template:Mbox
(
edit
)
Template:Para
(
edit
)
Template:Strong
(
edit
)
Template:Template link code
(
edit
)
Template:Terminate sentence
(
edit
)
Template:Time ago
(
edit
)
Template:Tlc
(
edit
)
Module:Arguments
(
edit
)
Module:Date
(
edit
)
Module:List
(
edit
)
Module:Lua banner
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:NumberSpell
(
edit
)
Module:TableTools
(
edit
)
Module:Template link general
(
edit
)
Module:Text
(
edit
)
Module:Time ago
(
edit
)
Module:Yesno
(
edit
)