sql.How to get Quarter’s Start and End Date for a given date in Sql Server

PHOTO EMBED

Sat Oct 09 2021 17:28:32 GMT+0000 (Coordinated Universal Time)

Saved by @rick_m #sql

DECLARE @AnyDate DATETIME
SET @AnyDate = GETDATE()

SELECT @AnyDate AS 'Input Date',
  DATEADD(q, DATEDIFF(q, 0, @AnyDate), 0) 
                        AS 'Quarter Start Date',       
  DATEADD(d, -1, DATEADD(q, DATEDIFF(q, 0, @AnyDate) + 1, 0)) 
                        AS 'Quarter End Date'
content_copyCOPY

https://sqlhints.com/2013/07/20/how-to-get-quarter-start-end-date-sql-server/