ANS85 

The DAY-TO-YYYYDDD Function

The DAY-TO-YYYYDDD function converts argument-1 from the form YYnnn to the form YYYYnnn. Argument-2, when added to the year at the time of execution, defines the ending year of a 100-year interval, or sliding window, into which the year of argument-1 falls. The type of this function is integer.

General Format

    FUNCTION DAY-TO-YYYYDDD ( argument-1 [argument-2] ) 

Arguments

  1. Argument-1 must be a positive integer less than 100,000.
  2. Argument-2 must be an integer.
  3. If argument-2 is omitted, the function is evaluated as though 50 were specified.
  4. The sum of the year at the time of execution and the value of argument-2 must be less than 10,000 and greater than 1699.

Returned Values

  1. The equivalent arithmetic expression is:

    (FUNCTION YEAR-TO-YYYY (YY, argument-2) * 1000 + nnn)

    where:

      YY = FUNCTION INTEGER (argument-1/1000)   nnn = FUNCTION MOD (argument-1, 1000)

    and where argument-1 of the INTEGER and MOD functions and argument-2 of the YEAR-TO-YYYY functions are the same as argument-1 and argument-2 of the DAY-TO-YYYYDDD function itself.

Notes

  1. In the year 2002 the returned value for FUNCTION DAY-TO-YYYYDDD (10004,20) is 2010004. In the year 1994 the returned value for FUNCTION DAY-TO-YYYYDDD (95005, (-10)) is 1895005.
  2. This function supports a sliding window algorithm. See the notes for the YEAR-TO-YYYY function for a discussion of how to specify a fixed window.