Purpose
This function returns the date value of the next occurrence of the specified weekday (week) in the next week after the given date (date).
Syntax
NEXT_DAY (date,week)
Parameters
| Parameter | Description |
|---|---|
| date | A value of the DATE data type. |
| week | The weekday. Valid values: SUNDAY (Sunday), MONDAY (Monday), TUESDAY (Tuesday), WEDNESDAY (Wednesday), THURSDAY (Thursday), FRIDAY (Friday), and SATURDAY (Saturday). |
Return type
DATE
Examples
Return the date values corresponding to each weekday in the next week.
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