wolfjr
Say Hey Kid
Points: 713
More actions
February 21, 2002 at 7:05 am
#78214
Does any one know, how can I get the first day of some week. For instance, I want to know the first day of week "20" in year 2001.
Any help I appreciate.
WolfJr
jG
SSCrazy
Points: 2505
February 21, 2002 at 8:08 am
#424251
Look in BOL under the DATEADD Function.
Something like this
select dateadd(wk, 20, getdate())
-JG
Antares686
SSC Guru
Points: 125444
February 21, 2002 at 8:24 am
#424254
SELECT DATEADD(d,-DATEPART(dw,DATEADD(wk,20,'1/1/' + CAST(YEAR(GETDATE()) AS CHAR(4)))) + 1,DATEADD(wk,20,'1/1/' + CAST(YEAR(GETDATE()) AS CHAR(4))))
However 20 gives you week 21 not 20. Whatever number you enter is week # (your number + 1)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply