9.74 FINDDATE

Note: Built-In Function Rules     Usage Options

Finds the date that is 'n' days after/before a given date.

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

N

Req

Date to be counted from

6

8

0

0

2

N

Req

No. of days(+/-) after/before the given date.

Note: For non-IBM i systems, this value should be less than 214783648 and greater than -214783649, otherwise a fatal execution error will occur.

1

15

0

0

3

A

Opt

Date format of given date

Default: A

1

1

 

 

4

A

Opt

Date format of returned date

Default: A

1

1

 

 

 

Valid Date Formats

These date formats are valid formats for given and returned dates: A, B, D, F, H, J, L, V and 1.

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

N

Req

Returned date

6

8

0

0

2

A

Opt

Returned okay code (Y/N)

1

1

 

 

 

Note: All dates must have a four character year so that accurate comparisons and calculations can be performed. Where a two character year (e.g. DDMMYY, YYMMDD, MMYY) is supplied the century value is retrieved from the system definition data area. The year supplied is compared to a year in the data area, if the supplied year is less than or equal to the comparison year then the less than century is used. If the supplied year is greater than the comparison year then the greater than century is used.

Example

Find the date field #NXTDAT in date format YYMMDD (D) that is #NUMD days after date field #DMY in date format DDMMYY (B):

USE        BUILTIN(FINDDATE) WITH_ARGS(#DMY #NUMD B D)

           TO_GET(#NXTDAT)