Template talk:Years or months ago
Appearance
(Redirected from Template talk:Years or months ago/sandbox)
Hi! I have an article that I would like to use this template on, but I need the output to just say "years" instead of "years ago". How would I go about doing that? I'd like to be able to put in the date a person was sentenced to death row and have the template say how long they've been on death row in years (or months and years). Bali88 (talk) 19:26, 3 July 2014 (UTC)
- Hi @Bali88:! I recently had the very same question. Yes, it's 2 years since you posted your question, and I also note you've not been Wiki-editing in a year, but figured I'd answer as it may help others. There is no way I can see to use this
{{Years or months ago|...}}
template and tweak the output language (as one can do with say{{convert|...}}
). It would seem to be a good idea to allow this one day. But, there is a way to do what you (and I) want to do, here's how: One uses the{{Time ago|...}}
template. So, for example, if one wants to get the numeric difference from the current year to say 2011, one would use:
{{Time ago|2011|ago=}}
- This will output the number followed by the word "years", eg: "13 years" – the number depending on what year it is currently. So, one can create "It's been 13 years since the event occurred..." and "They've now been on death-row for over 13 years."
- If one wants just the numeric year value, one uses the
{{Age nts|...}}
template. So, for example, if one wants to get the numeric difference from the current year to 1975, one would use:
{{Age nts|1975|1|1}}
- This will output just the number "49" depending on what year it is currently. Maybe for use in something like, "Changes are still been observed during year 49 of its evolution." One must add the month and day dates (in this case "1|1" for Jan 1st), the year will adjust accordingly.
- Back to
{{Time ago|...}}
. One can set parameters to spell out the numeric year value and/or to change the time-period magnitude. For example:
{{Time ago|2011|ago=|magnitude=months|spellout=yes}}
- Which will give: "She won the medal 156 months ago."
- By mixing methods one can produce: "It was been 11 relatively quiet years since the big eruption, although 156 months of constant small earthquakes suggest to geologists that the activities are not over."
- There is a second way to just output the year number, and a reason one may wish to use it. One uses the
{{CURRENTYEAR}}
Wiki-Variable along with the{{#expr:...}}
Calculation template. So, for example, if one wants to get the numeric difference from the current year back to 1492, one would use:
{{#expr:{{CURRENTYEAR}}-1492}}
- This will output just the number "532" depending on what year it is currently. Maybe for use in something like, "Columbus sailed the ocean blue 532 long years ago." One does not include the month or day using this method. The reason to use this method is if one wishes to output the years as the equivalent words in English. There is a Wikipedia template designed to do this,
{{spellnum|...}}
. But, I found it cannot parse the output of the{{Age nts|...}}
template (it gives an "Invalid decimal numeral" error). It will parse{{#expr:...}}
outputs though. So, one can produce this: "Columbus sailed the ocean blue five hundred and thirty-two long years ago."
- I hope this helps, either you or others. Regards. – 71.236.191.197 (talk) 03:48, 5 June 2016 (UTC)
UPDATE: Looks as if there is a third way to accomplish this, one can use the Wiki Module
{{#invoke:StripToNumbers|...}}
. But do note that it is still in beta-test. Here, one can use the original{{Years or months ago|...}}
template. The module pulls out only the years value.
{{#invoke:StripToNumbers|main|{{Years or months ago|2011|6}}}}
- So, when the default output is: "13 years ago", the module's modified output is just "13". Or, for closer time periods:
{{#invoke:StripToNumbers|main|{{Years or months ago|{{CURRENTYEAR}}|1}}}}
- When the default output is: "8 months ago", the module's modified output is just "8".
- All these methods can also produce Ordinal numeric output such as "first", "twentieth", "one-hundrend and forty second" when used with the
{{Ordinal to word|...}}
template. An example would be:
{{Ordinal to word|{{#invoke:StripToNumbers|main|{{Years or months ago|1952|2}}}}|zeroth=zeroth}}
- Where one could produce something such as: "In the seventy-second year of her reign, the Queen..." Or with other values: "Now, in the forty-ninth year of his incarceration, he..."
- Regards. – 71.236.191.197 (talk) 23:29, 5 June 2016 (UTC)
Why is this template's input limited to years and months?
[edit]It would be nice to be able to use this template in running text in articles when a full date is known, generating something like:
The New York Times was founded 171 years ago, on September 18, 1851." (for example)
Might this be a future possibility? Thanks! 1980fast (talk) 00:20, 5 July 2023 (UTC)