473,388 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Using SQL to Manipulate Timestamps using Quarterly data

I am looking for SQL syntax that will enable me to subtract quarters
from timestamps. Any suggestions?

Pseudo-code example -

YEAR( timestamp_column - 9 Quarters)

I know that I can easily subtract things like DAYS. However, I can't
seem to be able to manipulate using Quarters.

Thanks.

Apr 24 '07 #1
2 2135
Ian
mike_dba wrote:
I am looking for SQL syntax that will enable me to subtract quarters
from timestamps. Any suggestions?

Pseudo-code example -

YEAR( timestamp_column - 9 Quarters)

I know that I can easily subtract things like DAYS. However, I can't
seem to be able to manipulate using Quarters.
Quarters aren't a labeled duration, as you've found. But can't you just
replace 'quarter' with '3 months'? So,

year(timestamp_column - 27 months)
I think you may run into an issue if calendar year quarters don't
coincide with fiscal year quarters...


Apr 24 '07 #2
Ian wrote:
mike_dba wrote:
>I am looking for SQL syntax that will enable me to subtract quarters
from timestamps. Any suggestions?

Pseudo-code example -

YEAR( timestamp_column - 9 Quarters)

I know that I can easily subtract things like DAYS. However, I can't
seem to be able to manipulate using Quarters.

Quarters aren't a labeled duration, as you've found. But can't you just
replace 'quarter' with '3 months'? So,

year(timestamp_column - 27 months)
I think you may run into an issue if calendar year quarters don't
coincide with fiscal year quarters...
I don't think that would matter. If you substract 3 months (1 quarter) from
January 31st, you get October 31st, which would be fine, wouldn't it?

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: lkrubner | last post by:
This might be an idiot question, but how do you group by timestamps by date? I mean, given a large number of timestamps, spanning many months, how do grab them and say how many are from each day?...
1
by: richardd | last post by:
Hi, I am writing code to deal with PCAP files. I have a PCAP dump and I am looking at the timestamps in the PCAP packet headers to see if they are in the correct order in the file. To do this I...
2
by: tran.loan | last post by:
I have a reporting query that I need to do a quarterly trending on. A user enters a begining date and end date, and from there, I have to determine the closest quarter to it. Also, the actual...
10
by: Craig Wahlmeier | last post by:
Am I the only one in the world that selects dates and timestamps with OLEDB? V8 of UDB has brought me a big problem. The PATCH2=24 setting no longer works the way it used to. The settings of...
4
by: Craig G | last post by:
im not too sure how i should be storing the SQL2000 timestamps basically i return a dataset which is used to populate an editable grid. this dataset contains the timestamp. how should i be...
6
by: Brandon | last post by:
I'm using PHP with MySQL 4.x and was having trouble converting a datetime from MySQL into a formatted string until I ran across this solution that converts a YYYY-MM-DD HH:MM:SS string into a...
16
by: maruk2 | last post by:
I have some old data files with old timestamps, where timestmap=time(NULL), some of them date back to the year 1999. I want to my code to print the timestamps and each one to include...
6
by: xkenneth | last post by:
All, Just a quick question. I want to be able to have a data structure that organizes data (timestamps I'm working with) sequentially, so that i can easily retrieve the first x amount of...
5
by: sparkbrook | last post by:
I'm trying to write a simple Access program that stores details of customers that have service contracts, payable monthly or quarterly (customer's choice). The program needs to print monthly or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.