DATE Query for iSeries function
The DATE function returns a date from a value. The form is:
DATE ( expression )
The argument must be either a:
v Timestamp
v Date
v Positive number or expression less than 3 652 059
v Valid character representation of a date
v Character representation with a length of 7
If the argument is a character representation of length 7, it must represent a valid date in the form yyyynnn
where yyyy represents the year digits and nnn represents digits between 001 and 366, signifying a day in
that year.
The result of this function is a date. If the argument can be null, the result can be null. If the argument is
null, the result is null.
v If the argument is a timestamp, the result is the date part of the timestamp.
v If the argument is a date, the result is that date.
v If the argument is a number, the result is the date that is n−1 days after January 1, 0001.
v If the argument is a character value, the result is the date represented by the character string.
Note: If the OS/400 two-digit year format is used, the range of dates is 1940 through 2039. Any year from
40 through 99 is assumed to have a century of 19. Any year 00 through 39 is assumed to have a
century of 20. If a value outside of that range is in a field with a two-digit year format, it will be
shown on a report as +’s. Use the CHAR function on that field specifying a SAA date format, and
then select the result field for the report.
Example:
DATE(STRDATE)
DAY Query for iSeries function
The DAY function returns the day part of a value. The form is:
DAY ( expression )
The argument must be either a:
v Date
v Timestamp
v Date duration
v Timestamp duration
The result of the function is a binary field. If the argument can be null, the result can be null. If the
argument is null, the result is null.
If the argument is a date or a timestamp, the result is the day part of the value, which is a binary field with
a value between 1 and 31.
Chapter 5. Defining result fields in Query for iSeries 75