Menu Close

TSQL – How to Find Quarter Start and End Date

If you would like to find the start and the end of a Quarter based of a date here is the t-sql code you will need:

DECLARE @yourdate DATETIME = GETDATE();

SELECT DATEADD(q, DATEDIFF(q, 0, @yourdate), 0) AS [Quarter_Start]
, DATEADD(d, -1, DATEADD(q, DATEDIFF(q, 0, @yourdate) + 1, 0)) AS [Quarter_End]

For getting the previous Quarter start and end dates refer to this post:
https://mkncreations.com/site/2014/10/tsql-how-to-find-previous-quarter-start-and-end-date/