Loading ...

Get first and last day of the week in sql | CodeAsp.Net

Get first and last day of the week in sql

 /5
0 (0votes)

In this blog I will explain how to get first and last day of the week in sql. Below is the code snippet.

DECLARE @date DATETIME

SET @date = '20090809'

Select DATEADD(wk, DATEDIFF(wk, 0, @date), 0) AS FirstDayOfWeek,

DATEADD(wk, DATEDIFF(wk, 0, @date)+1, -1) AS LastDayOfWeek

--Output

FirstDayOfWeek LastDayOfWeek

----------------------- -----------------------

2009-08-10 00:00:00.000 2009-08-16 00:00:00.000

 

 

 

Happy Reading.!

 

 

Comments (no comments yet)

Top Posts