This function is used to return the date closest to day_of_week after start_date.
next_day(string start_date, string day_of_week)
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
start_date |
Yes |
DATE or STRING |
Date that needs to be processed If the value is of the STRING type, the value must contain at least yyyy-mm-dd and cannot contain redundant strings. The following formats are supported:
|
day_of_week |
Yes |
STRING |
One day of a week, either the first two or three letters of the word, or the full name of the word for that day. For example, TU indicates Tuesday. |
The return value is of the DATE type, in the yyyy-mm-dd format.
The value 2023-08-22 is returned.
select next_day('2023-08-16','TU');
The value 2023-08-22 is returned.
select next_day('2023-08-16 10:54:00','TU');
The value 2023-08-23 is returned.
select next_day('2023-08-16 10:54:00','WE');
The value NULL is returned.
select next_day('20230816','TU');
The value NULL is returned.
select next_day('20230816 20:00:00',null);