Purpose
This function returns the date of the next occurrence of the specified weekday (week) after the given date (date).
Syntax
NEXT_DAY (date,week)
Parameters
| Parameter | Description |
|---|---|
| date | A value of the DATE data type. |
| week | A weekday value. Valid values: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, and SATURDAY. |
Return type
DATE
Examples
The following example returns the date of the next occurrence of each weekday after the current date.
obclient> 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,'SATURDAY') "Next Saturday",
NEXT_DAY(SYSDATE,'SUNDAY') "Next Sunday"
FROM DUAL;
+--------------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
| Current Date | Next Monday | Next Tuesday | Next Wednesday | Next Thursday | Next Friday | Next Saturday | Next Sunday |
+--------------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
| 17-NOV-21 | 22-NOV-21 | 23-NOV-21 | 24-NOV-21 | 18-NOV-21 | 19-NOV-21 | 20-NOV-21 | 21-NOV-21 |
+--------------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
1 row in set