skip to main content
Corticon Studio: Rule Language Guide : Rule operator details and examples : Years between
 

Try Corticon Now

Years between

SYNTAX

<DateTime1>.yearsBetween(<DateTime2>)
<Date1>.yearsBetween(<Date2>)

DESCRIPTION

Returns the Integer number of years between DateTimes or between Dates. The number of months in <DateTime2> is subtracted from the number of months in <DateTime1>, and the result is divided by 12 and truncated. This function returns a positive number if <DateTime2> is later than <DateTime1>.

USAGE RESTRICTIONS

The Operators row of the table in Summary Table of Vocabulary Usage Restriction applies. No special exceptions.

RULESHEET EXAMPLE

The following Rulesheet uses .yearsBetween to determine the number of months that have elapsed between dateTime1 and dateTime2, compare it to the Values set, and assign a value to string1.

SAMPLE TEST

A sample Ruletest provides dateTime1 and dateTime2 for two examples. Input and Output panels are shown below.