Showing posts with label Date function. Show all posts
Showing posts with label Date function. Show all posts

Wednesday, April 2, 2014

Date Functions in TSQL

To get the first date of the week by passing the week id

dateadd(wk, datediff(wk, 0, getdate()), 0)

To get the last date of the week by passing the week id

dateadd(wk, datediff(wk, 0, getdate()), 0) + 6