All Products
Search
Document Center

PolarDB:NEXT_DAY

Last Updated:Mar 28, 2026

Returns the date of the first occurrence of the specified day of the week that is strictly later than the given date.

Syntax

NEXT_DAY(date, day_of_week)

Arguments

ArgumentDescription
dateThe starting date. If the value includes a time portion, the time is carried forward to the result unchanged.
day_of_weekThe target day of the week. Must contain at least the first three letters of the day name.

Valid values for `day_of_week`:

Full nameAccepted abbreviations
SUNDAYSUN
MONDAYMON
TUESDAYTUE
WEDNESDAYWED
THURSDAYTHU
FRIDAYFRI
SATURDAYSAT

Returns

Returns the first occurrence of the specified day that comes after date. The time portion of date is preserved in the result.

Examples

Return the first Sunday after August 13, 2007:

SELECT NEXT_DAY(TO_DATE('13-AUG-07','DD-MON-YY'),'SUNDAY') FROM DUAL;

Output:

      next_day
--------------------
 19-AUG-07 00:00:00
(1 row)

Return the first Monday after August 13, 2007 using the three-letter abbreviation:

SELECT NEXT_DAY(TO_DATE('13-AUG-07','DD-MON-YY'),'MON') FROM DUAL;

Output:

      next_day
--------------------
 20-AUG-07 00:00:00
(1 row)