473,804 Members | 3,750 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beginning and Ending DATE of a Quarter

benchpolo
142 New Member

First Day of the QUARTER

select DATEADD(qq, DATEDIFF(qq,0,g etdate()), 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
2 7658
ck9663
2,878 Recognized Expert Specialist

First Day of the QUARTER

select DATEADD(qq, DATEDIFF(qq,0,g etdate()), 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
2 New Member
SELECT DATEADD(QQ, DATEDIFF(QQ,0,G ETDATE())-1,0) as [Start Of Last Quarter]
,DATEADD(s,-1,DATEADD(QQ, DATEDIFF(QQ,0,G ETDATE()),0)) as [End Of Last Quarter]

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

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

Similar topics

2
5227
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much appreciated. TIA
5
3144
by: whornak | last post by:
Is there a way to figure out from a given date the 'week of the year' or 'quarter of the year' that it exists in? I need to manage report generation that are required to be done automitically on a Weekly, Monthly or Quarterly basis using the last run date and a Weekly, Monthly or Quarterly indicator.
3
14522
by: Matt | last post by:
Hello, I have a query that I would like to schedule in DTS. The criteria of this query checks for records in the table that are within the current quarter. Here is what I have. WHERE submit_date BETWEEN '01/01/2005' AND '03/31/2005' I would like to dynamically generate the Quarter End and Quarter Beginning dates within my where clause based on the date that DTWS
1
1451
by: Cathy | last post by:
Can someone help me with this logic Iff "Current Quarter =1 then "Past Quarter=4 Or If "Curent Quarter" = 2 Then "Past Quarter =1...and so on. I can find previous quarter base on my current quarter by using the following lines of code. I don't know how the next coding for second quarter. SELECT tblSchedule.Adate, tblSchedule.Lot, tblSchedule.Qty, tblSchedule., tblSchedule. FROM tblSchedule
3
5936
by: Matt | last post by:
Given a date, how to find the beginning date and ending date of that week please advise!
4
2567
by: norma.j.hildebrand | last post by:
I have a database that has a field (performance standard), every year the standard changed which was not a problem since we start out each year with a blank database and just change the standards based on the prior years performance. Now they threw me a curve ball... They want to change the standards every quarter. This standard is matched up with an item that is referenced in a daily production table to figure out our percentage of...
1
2565
by: egrill | last post by:
I can access the date field from OBCC tables and do the normal date range for a quarterly report for each quarter I need the formula so I can sort the records into individual quarter having them side by side with the appropriate sum of the date. For example the result would look like this Name QTR 1 QTR 2 QRT 3 ABC Comp $10000 $12000 $ 120000 DEF Company $9999 $30000 $ 40000
5
2797
slifland
by: slifland | last post by:
I am trying to make a appointment book for a access 2003 database. I would like the report to display the title "Appointments for "month day" - "month day" "year" What I have so far doesn’t do quite what I want it to do as far as showing the beginning Date of the Appointment week and the ending Date of the appointment week. = DB field that has the Appointment Date in the format “mm/dd/yyyy” =IIf(>Date(),"Appointments for " &...
2
5453
by: Supermansteel | last post by:
Our team does numerous tests each month. Each person can run a report to automatically tally up all the results for the quarter. I have then created a Form specifically to enter our Analysis for the Quarter because it goes up to the CEO (so I seperated it because it has to have many revisions with our comments). For the Date Field I can't figure out the best way to put the date together for the Quarter. Options I have come up with: 1....
0
9584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9160
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5654
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.