Template:DateDiff: Difference between revisions

Jump to navigation Jump to search
can't get the lua version to work. revert
(username removed)
No edit summary
Tag: Manual revert
(username removed)
(can't get the lua version to work. revert)
Tag: Undo
Line 1: Line 1:
<includeonly>{{#invoke:DateDiff|DateDiff}}</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>
(username removed)

Navigation menu