NEXT_DAY

Click to skip syntax diagram
Read syntax diagramSkip visual syntax diagram>>-NEXT_DAY--(--expression--,--string-expression--)------------><
 

The NEXT_DAY function returns a timestamp that represents the first weekday, named by string-expression, that is later than the date expression. If expression is a timestamp or valid string representation of a timestamp, the timestamp value has the same hours, minutes, seconds, and microseconds as expression. If expression is a date, or a valid string representation of a date, then the hours, minutes, seconds, and microseconds value of the result is 0.

expression
The argument must be an expression that returns a value of one of the following built-in data types: a date, a timestamp, a character string, or a graphic string.

If expression is a character or graphic string, it must not be a CLOB or DBCLOB and its value must be a valid string representation of a date or timestamp. For the valid formats of string representations of dates and timestamps, see String representations of datetime values.

string-expression
An expression that returns a built-in character string data type or graphic string data type. The value must compare equal to the full name of a day of the week or compare equal to the abbreviation of a day of the week. For example, in the English language:
Day of Week Abbreviation
MONDAY MON
TUESDAY TUE
WEDNESDAY WED
THURSDAY THU
FRIDAY FRI
SATURDAY SAT
SUNDAY SUN
The minimum length of the input value is the length of the abbreviation. Leading and trailing blanks are trimmed from string-expression. The resulting value is then folded to uppercase, so the characters in the value may be in any case.

The result of the function is a timestamp. If either argument can be null, the result can be null; if either argument is null, the result is the null value.

Note

National language considerations: The values of the days of the week (or abbreviations) in string-expression may either be the US English values listed in the table above or the values based on the language used for messages in the job. The non-abbreviated name of the day is retrieved from message CPX9034 in message file QCPFMSG in library *LIBL. The abbreviated name of the day is retrieved from message CPX9039 in message file QCPFMSG in library *LIBL.

Applications that need to run in many different language environments may want to consider using US English values since they will always be accepted in the NEXT_DAY function.

Example