Oracle 19c on Windows.
I have a query that returns dates of cargo arrival. I need to determine what week of the month this date falls into. Also, how do I find a start/end date for that week?
This can be used as a test
select to_date('3/3/2021','mm/dd/yyyy') port_date, 100 cargo_wt from dual
union all
select to_date('3/5/2021','mm/dd/yyyy') port_date, 98 cargo_wt from dual
union all
select to_date('3/14/2021','mm/dd/yyyy') port_date, 33 cargo_wt from dual
I tried to use to_date(port_date,'W') to determine the week number. It shows that 3/14 falls into week 2. Is this an expected behaviour? Is it Monday to Sunday? If this is correct, then how to determine the start/end dates of the week?