Template:DATE2COMP

From Wikipedia, the free encyclopedia

Below is the documentation of this template. See the lists of templates on Wikipedia.
Purge server cache if the template uses noinclude, and your changes does not appear..

This template compare two dates in the Gregorian calendar. It returns the value of one of the optional named parameters.

Syntax:
{{DATE2COMP
|year1|month1|day1|year2|month2|day2|year3|month3|day3|
test options}}
{{DATE2COMP
|year1|month1|day1|year2|month2|day2|year3|month3|day3|hour1|hour2|hour3|
test options}}
{{DATE2COMP
|year1|month1|day1|year2|month2|day2|year3|month3|day3|hour1|hour2|hour3|minute1|minute2|minute3|
test options}}
{{DATE2COMP
|year1|month1|day1|year2|month2|day2|year3|month3|day3|hour1|hour2|hour3|minute1|minute2|minute3|second1|second2|second3|
test options}}
  • The dates can optionally be given more precision with time (their default time is noon, i.e. 12:00:00 UTC), for computing timezones.
  • This template assumes (but does not check) that date2 comes strictly after date1.
  • If date3 comes strictly before date1 then the return value will contain the values of named parameters before, before or first.
  • If date3 is the same as date1 then the return value will contain the values of named parameters before or first, between not last, between.
  • If date3 comes strictly after date1 but before date2 then the return value will contain the values of named parameters between not last, between, between not first, between exclusive.
  • If date3 is the same as date2 then the return value will contain the values of named parameters between, between no start, after or last.
  • If date3 comes strictly after date2 then the return value will contain the values of named parameters after or last, after.
Test options:
before=text if date3 comes strictly before date1|
before or first=text if date3 equals or comes before date1|
between not last=text if date3 comes between date1 and date2 excluding last|
between=text if date3 comes between date1 and date2 inclusively|
between not first=text if date3 comes between date1 and date2 excluding first|
between exclusive=text if date3 comes between date1 and date2 exclusively|
after or last=text if date3 equals or comes after date2|
after=text if date3 comes strictly after date2|
first or not between=text if date3 does not come between date1 and date2 excluding first|
not between=text if date3 does not come between date1 and date2 inclusively|
last or not between=text if date3 does not come between date1 and date2 excluding last|
not between exclusive=text if date3 does not come between date1 and date2 exclusively|

In most cases, only one or a few named parameters will be used, depending on the conditions to test. Unspecified named parameters are ignored:

  • To compare with an inclusive interval, specify the values of:
    • between, not between; or
    • before, between, after.
  • To compare with an exclusive interval, specify the values of:
    • between exclusive, not between exclusive; or
    • before or first, between exclusive, after or last.
  • To compare with a half-open interval excluding last date, specify the values of:
    • between not last, last or not between; or
    • before, between not last, after or last.
  • To compare with a half-open interval excluding first date, specify the values of:
    • between not first, first or not between; or
    • before or first, between not first, after.
See also: