Monday, November 12, 2007

Calculate date from week of year, or week to date

Useful solution for finding the date of first day of a given week, and year.

select decode(to_Char(to_date('01-JAN-'||&Cur_year),'DY'),'MON', to_date('01-JAN-'||&Cur_year),next_day(to_date('01-JAN-'||&Cur_year),'MON'))+(7*(&cur_week-1)) from dual


Value of Cur_year may be any year and Cur_week must be between 1-52.


Thank you Sandy for this solution.  

Windows (powershell) counterparts of Linux commands

You may find Windows mostly powershell equivalent of frequently used Linux commands here. I will update this post, with newer ones by the ti...