next_day
The next_day function is used to return the date closest to the specified day of the week after the start date.
Syntax
next_day(string start_date, string day_of_week)
Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| start_date | Yes | DATE or STRING | The start date. When start_date is of type STRING, it must contain at least yyyy-mm-dd and must not contain extra characters. Formats:
|
| day_of_week | Yes | STRING | The two or three letter abbreviation of the day name, or the full day name. For example, TU indicates Tuesday. |
Return Values
Returns a date value of type DATE, in the format yyyy-mm-dd.
- If start_date is not of type DATE or STRING, an error is returned with the message "data type mismatch".
- If start_date is of type DATE or STRING but does not conform to the input format for date values, NULL is returned.
- If the start_date value is NULL, NULL is returned.
- If the day_of_week value is NULL, NULL is returned.
Example Code
- Example 1
select next_day('2023-08-16','TU');Returns 2023-08-22.
- Example 2
select next_day('2023-08-16 10:54:00','TU');Returns 2023-08-22.
- Example 3
select next_day('2023-08-16 10:54:00','WE');Returns 2023-08-23.
- Example 4
select next_day('20230816 20:00:00',null);Returns NULL.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot