Oracle NEXT_DAY function
How to get the date of the first weekday in Oracle?
The Oracle NEXT_DAY function returns the date of the first specified weekday that is later than the given date. It allows you to easily calculate the next occurrence of a specific weekday, such as Monday, after a certain date.
Uses of Oracle NEXT_DAY function:
- Scheduling tasks on the next weekday: Determine the next specific weekday after a given date for scheduling purposes.
- Calculating future deadlines: Automatically calculate the next weekday when a deadline falls on a non-working day.
- Finding the next occurrence of holidays or events: Identify the next occurrence of a recurring event on a specific weekday.
- Date calculation in payroll or billing cycles: Use to calculate the next weekday for payroll processing or invoice generation.
- Creating date-based reports: Generate reports that require data from the next specified weekday after a given date.
Syntax:
NEXT_DAY(date, char)
Parameters:
Name | Description |
---|---|
date | A date value used to get the next weekday. |
char | Day of the week, either the full name or the abbreviation. The minimum number of letters required is the number of letters in the abbreviated version. Any characters immediately following the valid abbreviation are ignored. |
Return Value:
The return value has the same hours, minutes, and seconds component as the parameter date.
Pictorial Presentation
Examples: Oracle NEXT_DAY () function
This example returns the date of the next Monday after March 12, 2015 :
SQL> SELECT NEXT_DAY('12-MAR-2015','MONDAY') "NEXT DAY"
2 FROM DUAL;
Sample Output:
NEXT DAY -------------------- 16-MAR-2015 00:00:00
Previous:
NEW_TIME
Next:
NUMTODSINTERVAL
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/oracle/datetime-functions/oracle-next_day-function.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics