Template:DateDiff: Difference between revisions

From SilentBlue.RemyWiki
Jump to navigation Jump to search
(username removed)
No edit summary
m (Undo revision 25323 by Phuzion (talk))
Tag: Manual revert
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#invoke:DateDiff|DateDiff|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}}}</includeonly>
<includeonly>{{formatnum:{{#expr:
        + {{#expr:  
       
 
        + (({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} - 1) * 365)
        + ((({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} - 1) - (({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} - 1) mod 4)) / 4)   
        - ((({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} - 1) - (({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} - 1) mod 100)) / 100)
        + ((({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} - 1) - (({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} - 1) mod 400)) / 400)
 
     
        + {{ #ifexpr:   
                    ({{{month2|{{{5|{{CURRENTMONTH}}}}}}}} - 1) < 8
                    | ( ({{{month2|{{{5|{{CURRENTMONTH}}}}}}}} - 1) * 30.5 round 0)
                    | ( ({{{month2|{{{5|{{CURRENTMONTH}}}}}}}} - 1) * 30.5 + 0.9 round 0 )
          }}
        - {{ #ifexpr: ({{{month2|{{{5|{{CURRENTMONTH}}}}}}}} <= 2) | 0 | 
            {{ #ifexpr:   
                    ({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} / 4) = ({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} / 4 round 0)         
                      and ({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} / 100 != {{{year2|{{{4|{{CURRENTYEAR}}}}}}}} / 100 round 0) 
                | 1 | 2
            }}
          }}
        + {{ #ifexpr: ({{{month2|{{{5|{{CURRENTMONTH}}}}}}}} <= 2) | 0 |
            {{ #ifexpr:
                    ({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} / 400) = ({{{year2|{{{4|{{CURRENTYEAR}}}}}}}} / 400 round 0)
                | 1 | 0
            }}
          }}
        + {{{day2|{{{6|{{CURRENTDAY}}}}}}}}
}}{{#ifexpr: {{{year2|{{{4|{{CURRENTYEAR}}}}}}}} < 1 |
        _ERROR - Can not handle dates before January 1, 1 A.D.
  }}
        - {{#expr:
       
 
        + (({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} - 1) * 365)
        + ((({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} - 1) - (({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} - 1) mod 4)) / 4)   
        - ((({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} - 1) - (({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} - 1) mod 100)) / 100)
        + ((({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} - 1) - (({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} - 1) mod 400)) / 400)
 
     
        + {{ #ifexpr:   
                    ({{{month1|{{{2|{{CURRENTMONTH}}}}}}}} - 1) < 8
                    | ( ({{{month1|{{{2|{{CURRENTMONTH}}}}}}}} - 1) * 30.5 round 0)
                    | ( ({{{month1|{{{2|{{CURRENTMONTH}}}}}}}} - 1) * 30.5 + 0.9 round 0 )
          }}
        - {{ #ifexpr: ({{{month1|{{{2|{{CURRENTMONTH}}}}}}}} <= 2) | 0 | 
            {{ #ifexpr:   
                    ({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} / 4) = ({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} / 4 round 0)         
                      and ({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} / 100 != {{{year1|{{{1|{{CURRENTYEAR}}}}}}}} / 100 round 0) 
                | 1 | 2
            }}
          }}
        + {{ #ifexpr: ({{{month1|{{{2|{{CURRENTMONTH}}}}}}}} <= 2) | 0 |
            {{ #ifexpr:
                    ({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} / 400) = ({{{year1|{{{1|{{CURRENTYEAR}}}}}}}} / 400 round 0)
                | 1 | 0
            }}
          }}
        + {{{day1|{{{3|{{CURRENTDAY}}}}}}}}
}}{{#ifexpr: {{{year1|{{{1|{{CURRENTYEAR}}}}}}}} < 1 |
        _ERROR - Can not handle dates before January 1, 1 A.D.
  }} }} }}</includeonly>

Latest revision as of 14:21, 23 June 2023