Building and Using Dashboards > Dashboard Function Reference > Scalar Functions > Date Compare
Date Compare
Compares Date 1 and Date 2, each rounded down to the nearest Date Part.
Return Value
If Date 1 (rounded down to the nearest Date Part) is less than Date 2 (rounded down to the nearest Date Part), the function returns -1. If Date 1 (rounded down to the nearest Date Part) is greater than Date 2 (rounded down to the nearest Date Part), the function returns 1. If Date 1 (rounded down to the nearest Date Part) equals Date 2 (rounded down to the nearest Date Part), the function returns 0.
For example, comparing 08/30/03 05:32 PM to 08/30/03 04:47 PM with Date Part set to m (for minute resolution) returns 1, while setting Date Part to d (for day resolution) causes this function to return 0.
Arguments
This function has the following arguments:
*Date 1: Text string specifying one of the dates to be compared. It must be either a formatted date/time string or a Java standard date/time argument in milliseconds from Jan 1, 1970.
*Date 2: Text string specifying the other date to be compared. It must be either a formatted date/time string or a Java standard date/time argument in milliseconds from Jan 1, 1970.
*Date Part: Text string that controls the resolution of the comparison. Specify s, m, h, d, w, M, q or y for seconds, minutes, hours, days, weeks, months, quarters or years.
The function returns a number.
Copyright © 2013-2015 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.