The NEXT_DAY function returns the date value of the weekday c1 in the week following the date d1.
Syntax
NEXT_DAY (d1[,c1])
Parameters
| Parameter | Description |
|---|---|
| d1 | A value of the DATE data type. |
| c1 | A weekday value. Valid values: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, and SUNDAY. |
Return type
DATE data type
Examples
The following statements are used to query the date values that correspond to each weekday value in the next week:
SELECT SYSDATE Current date,
NEXT_DAY(SYSDATE,'MONDAY') Next Monday,
NEXT_DAY(SYSDATE,'TUESDAY') Next Tuesday,
NEXT_DAY(SYSDATE,'WEDNESDAY') Next Wednesday,
NEXT_DAY(SYSDATE,'THURSDAY') Next Thursday,
NEXT_DAY(SYSDATE,'FRIDAY') Next Friday,
NEXT_DAY(SYSDATE, 'Saturn ') Next Saturday,
NEXT_DAY(SYSDATE,'SUNDAY') Next Sunday
FROM DUAL;
The following query result is returned:
+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+
| Current date | Next Monday | Next Tuesday | Next Wednesday | Next Thursday | Next Friday | Next Saturday | Next Sunday |
+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+
| 2020-03-08 15:47:57 | 2020-03-09 15:47:57 | 2020-03-10 15:47:57 | 2020-03-11 15:47:57 | 2020-03-12 15:47:57 | 2020-03-13 15:47:57 | 2020-03-14 15:47:57 | 2020-03-15 15:47:57 |
+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+