Template:MonthDiff: Difference between revisions

From 118Wiki
Jump to navigation Jump to search
(Undo revision 300802 by Pholin (talk))
Tag: Undo
mNo edit summary
Line 1: Line 1:
<includeonly>{{#ifeq:{{#expr: trunc({{{4}}}+{{{5}}}/12+{{{6}}}/(30*12)-({{{1}}}+{{{2}}}/12+{{{3}}}/(30*12)))}} years|0 years||{{#ifeq:{{#expr: trunc({{{4}}}+{{{5}}}/12+{{{6}}}/(30*12)-({{{1}}}+{{{2}}}/12+{{{3}}}/(30*12)))}} years|1 years|1 year|{{#expr: trunc({{{4}}}+{{{5}}}/12+{{{6}}}/(30*12)-({{{1}}}+{{{2}}}/12+{{{3}}}/(30*12)))}} years}}}} {{#ifeq:{{#expr:{{{4}}}*12+{{{5}}}+{{{6}}}/30-({{{1}}}*12+{{{2}}}+{{{3}}}/30)-(trunc({{{4}}}+{{{5}}}/12+{{{6}}}/(30*12)-({{{1}}}+{{{2}}}/12+{{{3}}}/(30*12))))*12round0}} months|1 months|1 month|{{#expr:{{{4}}}*12+{{{5}}}+{{{6}}}/30-({{{1}}}*12+{{{2}}}+{{{3}}}/30)-(trunc({{{4}}}+{{{5}}}/12+{{{6}}}/(30*12)-({{{1}}}+{{{2}}}/12+{{{3}}}/(30*12))))*12round0}} months}}</includeonly><noinclude>
<includeonly>{{#ifeq:{{#expr: trunc({{{4}}}+{{{5}}}/12+{{{6}}}/(30*12)-({{{1}}}+{{{2}}}/12+{{{3}}}/(30*12)))}} years|0 years||{{#ifeq:{{#expr: trunc({{{4}}}+{{{5}}}/12+{{{6}}}/(30*12)-({{{1}}}+{{{2}}}/12+{{{3}}}/(30*12)))}} years|1 years|1 year|{{#expr: trunc({{{4}}}+{{{5}}}/12+{{{6}}}/(30*12)-({{{1}}}+{{{2}}}/12+{{{3}}}/(30*12)))}} years}}}} and {{#ifeq:{{#expr:{{{4}}}*12+{{{5}}}+{{{6}}}/30-({{{1}}}*12+{{{2}}}+{{{3}}}/30)-(trunc({{{4}}}+{{{5}}}/12+{{{6}}}/(30*12)-({{{1}}}+{{{2}}}/12+{{{3}}}/(30*12))))*12round0}} months|1 months|1 month|{{#expr:{{{4}}}*12+{{{5}}}+{{{6}}}/30-({{{1}}}*12+{{{2}}}+{{{3}}}/30)-(trunc({{{4}}}+{{{5}}}/12+{{{6}}}/(30*12)-({{{1}}}+{{{2}}}/12+{{{3}}}/(30*12))))*12round0}} months}}</includeonly><noinclude>
This templates allows you to (approximately) calculate the amount of years and months between two dates.
This templates allows you to (approximately) calculate the amount of years and months between two dates.



Revision as of 07:52, 15 June 2020

This templates allows you to (approximately) calculate the amount of years and months between two dates.

For example, {{MonthDiff|2397|5|18|2397|6|6}} produces and 1 month.

If you want to use the current date, use {{CurrentStarYear}} to get the current staryear. Use {{CURRENTMONTH}} to produce the current month, and {{CURRENTDAY2}} for the day of the month.

For example, {{MonthDiff|2395|9|5|{{CurrentStarYear}}|{{CURRENTMONTH}}|{{CURRENTDAY2}}}} produces 5 years and 8 months.

NOTE: This does not error check at all.