Open main menu
Home
Random
Recent changes
Special pages
Community portal
Settings
About NowMusic Wiki
NowMusic Wiki
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Template:Time ago/doc
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!
{{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)
Templates used on this page:
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
)