Calculation of Week Start Date and Week End Date on given day in SQL

Week Start Date:


SELECT DATEADD(dd,1-Datepart(DW,getdate()),GETDATE())

Week End Date:

SELECT DATEADD(dd,7-Datepart(DW,getdate()),GETDATE())

Month Start Date

SELECT DATEADD(mm, -1,DATEADD(dd, +1, EOMONTH(GetUTCDATE())))

Month End Date

SELECT EOMONTH(GetUTCDATE())

Comments

Popular posts from this blog

MS CRM 4.0 Relationship Mappings Error

Open Data Protocol

Using Read-only versus const