I need to calculate Daysin_process between two dates such that Saturday and sunday are not included .Also it should consider start date and end date in calculation.
for example 1 – start_date = 26-07-2024 and end_date = 29-07-2024 so Daysin_process will be 2 as it excludes saturday and sunday.
example 2 – if start_date = 28-07-2024 (sat) and end_date = 29-07-2024(mon) Daysin_process = 2 excludes sunday
I have a logic to calculate Saturday Sunday –>
FUNCTION is_weekend (p_date IN DATE)
RETURN BOOLEAN
IS
BEGIN
IF TO_CHAR (TRIM (TO_CHAR (p_date, ‘DAY’))) IN (‘SATURDAY’, ‘SUNDAY’)
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
Write a pl/sql query for this logic also , i might another condition which will exclude holidays!
Please help guys!!
start Date End Date Expected Days
07/26 – Fri 07/29 – Mon 2
07/26 – Fri 07/30 – Tue 3
07/24 – Wed 07/26 – Fri 3
07/28 – Sat 07/29 – Mon 2