If you want to find out the week start date and week end date from any date, it is possible in Oracle with different way, since their is no direct function available in oracle
SELECT TRUNC(sysdate, 'iw') - 1 AS week_start_date ,(TRUNC(sysdate, 'iw') + 7 - 1 / 86400) - 1 AS week_end_date ,CASE WHEN TO_CHAR(sysdate, 'DY') = 'SUN' THEN (TRUNC(sysdate + 1, 'iw') + 7 - 1 / 86400) - 1 ELSE (TRUNC(sysdate, 'iw') + 7 - 1 / 86400) - 1 END --If aby custom Week start date or end date, In my case i handled for Sunday as week start date FROM dual;
No comments:
Post a Comment