I would like to get the dates for the last quarter and next quarter.
I have tried:
SELECT
convert(date, DATEADD(q, DATEDIFF(q,0,GETDATE()) -1 ,0)) FirstQDate,
convert(date, DATEADD(s,-1,DATEADD(q, DATEDIFF(q,0,GETDATE()),0))) LastQDate
The standard calendar quarters that make up the year are as follows: January, February, and March (Q1) April, May, and June (Q2) July, August, and September (Q3) October, November, and December (Q4)
Key Takeaways Q4, or the fourth quarter, is the last quarter of the financial year for companies. The Q4 dates for most companies follow the calendar year, starting on Oct. 1 and ending on Dec. 31.
Calendar Quarter Dates Q1 First Quarter: January 1st – March 31st. Q2 Second Quarter: April 1st – June 30th. Q3 Thirst Quarter: July 1st – September 30th. Q4 Fourth Quarter: October 1st – December 31st.
Check This
SELECT DATEADD(qq, DATEDIFF(qq, 0, GETDATE()) - 1, 0)-- First day of last quarter
SELECT DATEADD(dd, -1, DATEADD(qq, DATEDIFF(qq, 0, GETDATE()), 0))-- Last day of last quarter
SELECT DATEADD(qq, DATEDIFF(qq, 0, GETDATE()) + 1, 0)-- First day of Next quarter
SELECT DATEADD (dd, -1, DATEADD(qq, DATEDIFF(qq, 0, GETDATE()) +2, 0))-- Last day of Next quarter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With