Labels

Wednesday, June 14, 2017

SQL Server - T-SQL Query to find Monday of current week

T-SQL Query to find Monday of current week


We can write simple SQL query to get Monday of current week.

SELECT DATEADD(WK, DATEDIFF(WK,0,GETDATE()), 0)
SELECT DATEADD(WEEK, DATEDIFF(WEEK,0,GETDATE()), 0)


Above two query will return date of Monday in current week ex -2017-06-12 . So if you want to get other days like Tuesday, Wednesdays etc of current week, you can simply change int value in function.

 SELECT DATEADD(WK, DATEDIFF(WK,1,GETDATE()), 1)  -- Tuesday
 SELECT DATEADD(WK, DATEDIFF(WK,2,GETDATE()), 2)  --- Wednesday