Wednesday, January 6, 2016

Get Monday Date of the Current Week in SQL Server 2008

Simply copy the query below:

SELECT DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0)

Current Week:
  • Monday Date - SELECT DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0)
  • Tuesday Date - SELECT DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0) + 1
  • Sunday Date - SELECT DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0) + 6

In getting the Monday Date from the previous week, use SELECT DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0) - 7

No comments:

Post a Comment