Table of Contents

Search

  1. Preface
  2. The Transformation Language
  3. Constants
  4. Operators
  5. Variables
  6. Dates
  7. Functions
  8. Creating Custom Functions
  9. Custom Function API Reference

Transformation Language Reference

Transformation Language Reference

DATE_COMPARE

DATE_COMPARE

Returns an integer indicating which of two dates is earlier. DATE_COMPARE returns an integer value rather than a date value.

Syntax

DATE_COMPARE(
date1
,
date2
)
The following table describes the arguments for this command:
Argument
Required/
Optional
Description
date1
Required
Date/Time datatype. The first date you want to compare. You can enter any valid transformation expression as long as it evaluates to a date.
date2
Required
Date/Time datatype. The second date you want to compare. You can enter any valid transformation expression as long as it evaluates to a date.

Return Value

-1 if the first date is earlier.
0 if the two dates are equal.
1 if the second date is earlier.
NULL if one of the date values is NULL.

Example

The following expression compares each date in the DATE_PROMISED and DATE_SHIPPED ports, and returns an integer indicating which date is earlier:
DATE_COMPARE( DATE_PROMISED, DATE_SHIPPED )
DATE_PROMISED
DATE_SHIPPED
RETURN VALUE
Jan 1 1997
Jan 13 1997
-1
Feb 1 1997
Feb 1 1997
0
Dec 22 1997
Dec 15 1997
1
Feb 29 1996
Apr 12 1996
-1  
(Leap year)
NULL
Jan 6 1997
NULL
Jan 13 1997
NULL
NULL