Template:Time Ago
Note: parts of or the entire template might not be visible without values provided.
| Main | Documentation | 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 2 weeks
{{Time Ago|2025-12-23|last = y}} yields: In 2 weeks
{{Time Ago|2020-12-23|last = d}} yields: 4 years, 11 months, 2 weeks, 1 day ago
{{Time Ago|2019-12-23|last = month}} yields: 5 years, 11 months ago
- Pick and Choose units
{{Time Ago|2019-12-23|include = y,mth,d}} yields: 5 years, 11 months, 16 days ago
{{Time Ago|2019-12-23|include = mth}} yields: 71 months ago
{{Time Ago|2022-08-22|include = y,mth,d}} yields: 3 years, 3 months, 17 days ago
- No Labels
{{Time Ago|2020-09-28|hidelabel = 1}} yields: 5, 2, 1, 3, 11, 47, 20
{{Time Ago|2020-09-28|last = year|hidelabel = 1}} yields: 5
- Lowercase
{{Time Ago|2050-09-28|last = y|lowercase = 1}} yields: in 24 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 |