IBM SC41-5210-04 manual Date Query for iSeries function, DAY Query for iSeries function

Models: SC41-5210-04

1 294
Download 294 pages 6.42 Kb
Page 87
Image 87

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:

vTimestamp

vDate

vPositive number or expression less than 3 652 059

vValid character representation of a date

vCharacter 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.

vIf the argument is a timestamp, the result is the date part of the timestamp.

vIf the argument is a date, the result is that date.

vIf the argument is a number, the result is the date that is n−1 days after January 1, 0001.

vIf 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:

vDate

vTimestamp

vDate duration

vTimestamp 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

Page 87
Image 87
IBM SC41-5210-04 manual Date Query for iSeries function, DAY Query for iSeries function