Template:DateDiff: Difference between revisions

From SilentBlue.RemyWiki
Jump to navigation Jump to search
imported>Jack980517
 
(username removed)
(Replaced content with "<includeonly>{{#invoke:DateDiff|DateDiff}}</includeonly>")
Tag: Replaced
Line 1: Line 1:
<includeonly>{{formatnum:{{#expr:
<includeonly>{{#invoke:DateDiff|DateDiff}}</includeonly>
        + {{#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>

Revision as of 04:57, 13 June 2022