Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

last quarter and next quarter

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 
like image 488
PriceCheaperton Avatar asked Oct 02 '14 09:10

PriceCheaperton


People also ask

What does the next quarter mean?

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)

What are the dates for quarter 4?

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.

What is the first day of the next quarter?

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.


1 Answers

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
like image 144
Nitin Varpe Avatar answered Nov 15 '22 15:11

Nitin Varpe