Jump to content

User:DexDor/Cdtp

From Wikipedia, the free encyclopedia

OLD 0

This template takes a date and displays "OLD" (and the year/month) if it is more than a specified number of months ago. It does this by calculating (approximately) the number of days from Jan 0000.

Parameters:

1. Date in "yyyymmdd" format.
2. Number of months after which to display "OLD" (default 3).

If parameter 2 is set to -1 then it displays some self-diagnostic testing including the approximate (it assumes all months have 30 days) number of days since the date specified in parameter 1.

Parts of calculation:

(({{{1}}} ) / 10000) round 0 = Year
((({{{1}}} ) mod 10000)/100) round 0 = Month
{{{1}}} mod 100 = Day