By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,378 Members | 1,385 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,378 IT Pros & Developers. It's quick & easy.

Beginning and Ending DATE of a Quarter

benchpolo
100+
P: 142

First Day of the QUARTER

select DATEADD(qq, DATEDIFF(qq,0,getdate()), 0)


Question: How do I get the last DAY of the QUARTER?

For example: 1st Quarter is 01/01/2008 to 03/31/2008.

I am having difficulties finding the last day of the quarter.

Thanks in advance.
Apr 18 '08 #1
Share this Question
Share on Google+
2 Replies


ck9663
Expert 2.5K+
P: 2,878

First Day of the QUARTER

select DATEADD(qq, DATEDIFF(qq,0,getdate()), 0)


Question: How do I get the last DAY of the QUARTER?

For example: 1st Quarter is 01/01/2008 to 03/31/2008.

I am having difficulties finding the last day of the quarter.

Thanks in advance.
Get the first day of the next quarter then subtract by one day....

or

Add three months then subtract one day.

-- CK
Apr 18 '08 #2

hrothenb
P: 2
SELECT DATEADD(QQ, DATEDIFF(QQ,0,GETDATE())-1,0) as [Start Of Last Quarter]
,DATEADD(s,-1,DATEADD(QQ, DATEDIFF(QQ,0,GETDATE()),0)) as [End Of Last Quarter]

SELECT DATEADD(QQ, DATEDIFF(QQ,0,GETDATE()),0) as [Start Of Quarter]
,DATEADD(s,-1,DATEADD(QQ, DATEDIFF(QQ,0,GETDATE())+1,0)) as [End Of Quarter]
Sep 18 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.