Date of a day in a given week of the year

In the calender our weeks are defined as starting on Mondays and when we agree to number weeks of the year from 1 through 53, is given by WEEK(@d, 2)

set @d='2011-11-11';
select makedate( left(yearweek(@d),2),week( @d, 1 ) * 7 ) as 1stdayOfWeek;


makedate-1.gif


set @d='2008-7-15';
select makedate( left(yearweek(@d),4),week( @d, 2 ) * 7 ) as 1stdayOfWeek;


makedate--2.gif

Ebook Download
View all
Learn
View all