I want to find the Week of a Quarter from a sql date in Oracle.
I tried below query to find the year, quarter and week. But the week field gives the 'Week of the month' not the 'Week of the quarter'
select to_char(sysdate, 'YYYY')|| '-Q' || to_char(sysdate, 'Q') || '-W' || >to_char(sysdate, 'w') as "Current Time" from dual;
Above query returns '2016-Q2-W3' as the date falls in the 3rd week of the month.
Say sysdate is '17th June, 2016' I am expecting result as
2016-Q2-W12
My Week range is (Sunday - Saturday)
Since the '17th June, 2016' comes under 12th week of the quarter, it should be W12.
Thanks in advance.
select to_char(sysdate, 'YYYY-"Q"Q-"W"w') as "Current Time" from dual;
– MT0SELECT TRUNC( SYSDATE, 'Q' ) FROM DUAL
gives2016-04-01
which is a Friday. Does2016-Q2-W1
run from Friday - Thursday? Or does it run Monday - Sunday? Or something else? – MT0