Thursday, February 17, 2011

Start and End Date of specific date.

Declare @Date datetime, @Start Datetime, @End Datetime

SET @Date = '02/17/2011' ------- Your Date

SET @Start = DATEADD(dd, 1, DATEADD(dd, -DATEPART(dd, @Date), @Date))
SET @End = DATEADD(dd, -1, DATEADD(mm, 1, @Start))

SELECT @Start AS [Start Date], @End  AS [End Date]

No comments:

Post a Comment