Integration Cloud 6.6.0 | Built-In Services | Built-In Services | compareDates
 
compareDates
Compares two dates and returns the result as an integer.
Input Parameters
startDate
String Starting date to compare against endDate.
endDate
String Ending date to compare against startDate.
startDatePattern
String Format in which the startDate parameter is specified (for example, yyyyMMdd HH:mm:ss.SSS). For pattern-string notation, see the "Pattern String Symbols" section.
endDatePattern
String Format in which the endDate parameter is specified (for example, yyyyMMdd HH:mm:ss.SSS). For pattern-string notation, see the "Pattern String Symbols" section.
Output Parameters
result
String Checks whether startDate is before, the same, or after the endDate.
A value of...
Indicates that...
+1
The startDate is after the endDate.
0
The startDate is the same as the endDate.
-1
The startDate is before the endDate.
Usage Notes
If the formats specified in the startDatePattern and endDatePattern parameters are different, Integration Cloud takes the units that are not specified in the startDate and endDate values as 0.
That is, if the startDatePattern is yyyyMMdd HH:mm and the startDate is 20151030 11:11 and if the endDatePattern is yyyyMMdd HH:mm:ss.SSSand the endDate is 20151030 11:11:55:111, then the compareDates service considers start date to be before the end date and will return the result as -1.
To calculate the difference between two dates, use the calculateDateDifference service.