Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ELAPSED-DAYS( ) Output number of days difference

&pagelevel(3)&pagelevel

Domain: Environment information (calendar)

The ELAPSED-DAYS( ) function outputs the number of days difference between two specified dates.

Format

ELAPSED-DAYS( )

DATE = string_expression

,BASE = *STD / *TODAY / string_expression

Result type

INTEGER (<integer -3074323 .. 3074323>)

Input parameters

DATE = string_expression
Designates the end date.
The only permitted formats are *ISO, *AMERICAN and *GERMAN. The value must be greater than or equal to 1582-10-15.

BASE =
Designates the base date.
The only permitted formats are *ISO, *AMERICAN and *GERMAN.

BASE = *STD
The base date is the start of the 20th century (1900-01-01).

BASE = *TODAY
The base date is the current date.

BASE = string_expression
Specifies the base date.
The value is the date 1582-10-15 or later.

Notes

When BASE and DATE are specified, the following rules must be observed:

  • The format can only be *ISO, *GERMAN or *AMERICAN.

  • A leading zero is not required for the first 9 days or months. The year can be abbreviated to two-digit form, in which case the first two digits will be determined in the same way as for SDF data type <date with-compl>; e.g.

    Input year

    First two digits

    00..59

    20

    60..99

    19

Result

An integer number.

Error message

SDP0452  INVALID DATE

Example

/A = ELAPSED-DAYS (DATE=‘1963-12-30‘)
/SHOW-VARIABLE A
A = 23373 

/A = ELAPSED-DAYS (DATE='12/30/1963', BASE = '12/30/1900')
/SHOW-VARIABLE A
A = 23010 

/A = ELAPSED-DAYS (DATE='30.12.1963')
/SHOW-VARIABLE A
A = 23373 

/DIFF = ELAPSED-DAYS (DATE='2001-08-23',BASE='2001-04-01') 
/SHOW-VARIABLE DIFF 
DIFF = 144 

/DIFF = ELAPSED-DAYS (DATE='2001-08-23',BASE='2001-10-31')
/SHOW-VARIABLE DIFF 
DIFF = -69