### Testing and Comparing IDate Objects

You can compare two IDate objects to determine whether they are equal, or whether one is later than the other. The following operators are defined: ==, !=, <, <=, >, >=. For example, the expression if ((Day1>Day2) && (Day1!=Day3) evaluates to true if Day1 is January 1 1994, Day2 is June 3 1968, and Day3 is July 12 1941.

You can also check whether a particular year is a leap year, or whether a particular combination of day, month, and year is valid. The isLeapYear() function returns true if its integer argument is a leap year. The isValid() function accepts combinations of day, month, and year (or day of year and year), and returns true if the provided date is valid. For example, it returns true for the first date below, and false for the second date:

    if (IDate::isValid(IDate::June, 30, 1990)) // ...
    if (IDate::isValid(1965,366)               // ... False (No day number
                                               // 366 in 1965)