Note: parts of or the entire template might not be visible without values provided.
Main | Documentation | Draft | Usage |
Get the time since or time until a date.
Syntax
If the time is lower than the last date unit specified, the next valid date unit will be shown instead.
{{Time Ago|date|last = last date unit to display|include = comma list of the date units to display|hidelabel = show number only and hide label text}}
- Date units accepted:
- y or year — display up to years
- mth or month — display up to months
- w or week — display up to weeks
- d or day — display up to days
- h or hour — display up to hours
- min or minute — display up to minutes
- blank — displays up to seconds
- include — takes priority over last, enter a comma list of valid date units to display
- last — defaults to blank.
- lowercase — lowercase output.
Examples
- Basic Function
{{Time Ago|2025-12-23|last = w}} yields: In 1 year, 3 months
{{Time Ago|2025-12-23|last = y}} yields: In 1 year
{{Time Ago|2020-12-23|last = d}} yields: 3 years, 8 months, 4 weeks ago
{{Time Ago|2019-12-23|last = month}} yields: 4 years, 8 months ago
- Pick and Choose units
{{Time Ago|2019-12-23|include = y,mth,d}} yields: 4 years, 8 months, 29 days ago
{{Time Ago|2019-12-23|include = mth}} yields: 56 months ago
{{Time Ago|2022-08-22|include = y,mth,d}} yields: 2 years, 30 days ago
- No Labels
{{Time Ago|2020-09-28|hidelabel = 1}} yields: 3, 11, 3, 2, 5, 9, 8
{{Time Ago|2020-09-28|last = year|hidelabel = 1}} yields: 3
- Lowercase
{{Time Ago|2050-09-28|last = y|lowercase = 1}} yields: in 26 years
Template Data
Get the time since or time until a date.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Date | 1 | Datetime to display. | Date | required |
Last Unit | last | Smallest unit of time to display down to.
| String | suggested |
Units to Include | include | Comma list of unit(s) of time to display.
| String | suggested |
Hide Label | hidelabel | Set to "1" to remove "In", "ago", and time unit text.
| Boolean | optional |
Lowercase Output | lowercase | Set to "1" to have lowercase "in".
| Boolean | optional |