getDatesCompareResult( )
Compare two dates using a provided operation. This function handles partial dates.
01-Jun-2011 11:12:14
02-Jan-2011 17:UNK:UNK
01-Jun-2011 11
02-Jan-2011 17
Note:
This is a JavaScript function. Quotes are not needed in the rule variable name.Tip:
Since this function compares values, your rule expression may need to include a check to ensure the variables being passed are not null.Syntax
getDatesCompareResult(date1,isPartial1,date2,isPartial2,operation)
Parameters
- date1
-
Variable. Supports Date, Datetime and Time type variables, either full or with partial components.
- isPartial1
-
Indicates if the date1 variable is partial or not (true/false).
- date2
-
Variable. Supports Date, Datetime and Time type variables, either full or with partial components.
- isPartial2
-
Indicates if the date2 variable is partial or not (true/false).
- operation
-
The operation you want to use to compare date1 and date2. For example,
">"
,">="
,"<"
,"<="
,"==="
, or"!=="
.
Return value
Returns true or false.
Example 3-39 Check if date1 is greater than date2
// check if date 1 is greater than date 2
return getDatesCompareResult(date1,true,date2,false,">");
// returns true or false
Example 3-40 Compare time part of time and datetime variables using time components only
//compare time part of time (time1) and datetime (datetime1) components
var cdate1 = new C1Date (null, null, null, null, time1.getHour(), time1.getMinute(), time1.getSecond());
var cdate2 = new C1Date (null, null, null, null, datetime1.getHour(), datetime1.getMinute(), datetime1.getSecond());
return getDatesCompareResult(cdate1, true, cdate2, true, '===');
Parent topic: Date and time functions