 BPM Events User's Guide
The rule language : Time operations and expressions : Date functions

# Date functions

The section explains various date functions you can use in the rule language.

## Date comparison

The standard arithmetic operators apply for date comparison. For example, the following relational expressions are syntactically correct: YEAR:1997/MONTH:7 < EVT_1.date EVT_1.date + 15*DAY >= YEAR:1999/MONTH:6/D:15

## equality (=), inequality (!=)

Two dates are equal only if their date-units contain the same value, pair by pair. For example, the condition below is true:
YEAR:1997/MONTH:7 != YEAR:1997/MONTH:7/DAY:15

## after (>), before (<), after_or_equal (>=), before_or_equal (<=)

The following inequalities hold: YEAR:1997/MONTH:7/DAY:30 < YEAR:1997/MONTH:8 YEAR:1998 < YEAR:1998/MONTH:2

## dueDate

The dueDate and duration functions are based on regular time. The dueDate function returns the due date by adding the duration in milliseconds to a given date, as shown in the following example.
dueDate (startDate: date, duration:int): date
The following sample returns the due date by adding two hours to the event date:
val dt1 : date = dueDate(evt1.date, 2*60*60*1000) ;

## duration

The dueDate and duration functions are based on regular time. The duration function returns the duration, or the difference in time between the end date and the start date, in milliseconds. See the following example.
duration (startDate: date, endDate: date): int
The following sample returns the duration between the event date and the due date (dt1) calculated in the previous dueDate sample. It returns a value of two hours, using java.util.Date and java.util.Calendar classes:
val dur1 : int = duration(evt1.date, dt1) ;

## NOW

The function NOW returns the current date.