TEST-DAY-YYYYDDD

The TEST-DAY-YYYYDDD function tests whether a date in Julian date form (YYYYDDD) is a valid date in the Gregorian calendar. Argument-1 of the INTEGER-OF-DAY function must be in Julian date form.

The function type is integer.

Format

Read syntax diagramSkip visual syntax diagram FUNCTION TEST-DAY-YYYYDDD ( argument-1 )
argument-1
Must be an integer.

Returned values

  • If the value of argument-1 is less than 1601000 or greater than 9999999, the returned value is 1, which means the year is not within the range of 1601 to 9999.
  • If the value of FUNCTION MOD (argument-1 1000) is less than 1 or greater than the number of days in the year determined by FUNCTION INTEGER (argument-1/1000), the returned value is 2, which means the day is not valid in the given year.
  • Otherwise, the returned value is 0 (zero), which means the date is valid.

Examples

FUNCTION TEST-DAY-YYYYDDD (1995146) returns 0 because the date is valid.

FUNCTION TEST-DAY-YYYYDDD (1295146) returns 1 because the year is invalid and the value of argument-1 is less than 1601000.

FUNCTION TEST-DAY-YYYYDDD (1995446) returns 2 because the day is not valid in the given year and the value of FUNCTION MOD (argument-1 1000) is less than 1 or greater than the number of days in the year determined by FUNCTION INTEGER (argument-1/1000).