How can I implement this "iso month" from iso week?
In my example, the 31-12-2003 will not be computed in 2003 year if we've grouped by iso week and then we've grouped by month.
I have a customer that wants analyze his data with iso week, and he wants that when he groups by month, the result be coherent with the iso Week. I don't know if you understand me (sorry for my english) but I need that month, quarter and year be consistent with week (iso and standart) result, so, if week is 01, I need that month became 1 and. I have too, another version for this date (normal version) that group by standart week (week 53, month 12, quarter 3 and year 2003) I'm grounping by "iso" week and there is one date (31-12-2003, for example) that iso week is 01, so if iso week is 1, then I need that month be 1, quarter be 1 and year (iso year) be 2004. Let me show you my problem with one example: Please - check out the boundary value conditions!!! (eg: test this, date things can be tricky) This query generates all of the "first days of the week" by IW week for a select year, week,Ģ next_day( to_date( '04-jan-' || year, 'dd-mon-yyyy' ) + (week-2)*7, 'mon' )ģ from (select '2003' year, rownum week from all_objects where rownum <= 53 )
PL/SQL procedure successfully select next_day( to_date( '04-jan-' || :year, 'dd-mon-yyyy' ) + (:week-2)*7, 'mon' ) Well, we can use the fact that at least from 1800 to 2199, jan 4th is in the first week.