Template:DATECOMP

From Wikipedia, the free encyclopedia

[edit] Template documentation

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

Syntax:
{{DATECOMP|year1|month1|day1|year2|month2|day2|
test options}}
{{DATECOMP|year1|month1|day1|year2|month2|day2|hour1|hour2
test options}}
{{DATECOMP|year1|month1|day1|year2|month2|day2|hour1|hour2|minute1|minute2
test options}}
{{DATECOMP|year1|month1|day1|year2|month2|day2|hour1|hour2|minute1|minute2|second1|second2
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.
  • If date2 comes strictly before date1 then the return value will contain the values of named parameters before, not after, not same.
  • If date2 is the same as date1 then the return value will contain the values of named parameters not after, same, not before.
  • If date2 comes strictly after date1 then the return value will contain the values of named parameters not before, after, not same.
Test options:
before=text if date2 comes before date1 and dates are not the same|
not after=text if date2 comes before date1 or dates are the same|
same=text if date1 and date2 are the same|
not before=text if date2 comes after date1 or dates are the same|
after=text if date2 comes after date1 and dates are not the same|
not same=text if date1 comes are not the same|

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 test for equality of dates, specify the values of the following named parameters:
    • same, not same; or
    • before, same, after.
  • To test for inequilities of dates, specify the values of the following named parameters:
    • before, not before; or
    • after, not after.
See also: