David Fullerton-463561
SSC-Addicted
Points: 437
More actions
June 21, 2008 at 12:57 am
#208726
I am looking to use the GETDATE() function to return the current week integer minus 1 week.
this is what I came up with but it does not work.
Select DATEPART(w, GETDATE()) -1
any help would be appreciated.
Kev Riley
SSCrazy Eights
Points: 9075
June 21, 2008 at 3:26 am
#832183
David,
you need to use
Select DATEPART(wk, GETDATE()) -1
or
Select DATEPART(ww, GETDATE()) -1
Kev
June 21, 2008 at 3:30 am
#832184
Although I can't find it in BOL, using 'w' in DATEPART (or DATENAME) returns the day of the week, i.e. the same as using 'dw'.
June 21, 2008 at 8:32 am
#832205
Thanks that looks like it works.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply