Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding Fiscal Year from Given Date Field with DB2 Functions

Status
Not open for further replies.

jtrapat1

Programmer
Jan 14, 2001
137
0
0
US
I am using db2 version 7 and I need help calculating a date.

I am selecting certain records with date fields from one table and then inserting them into another table after I calculate the fiscal year date field.
The date from the first table is in this format: 01/22/1999, 01/20/2002, 06/08/1998, etc.

Now, for the first example, if the date falls between this fiscal year: April 1, 1998 - March 31, 1999, I will insert this record into a table with a budget year of 1998 (beginning of the fiscal year).

My question is this:
Does db2 provide any date functions which will help me to calculate this fiscal year date?
Or, do I have to use BETWEEN followed by my date range?

What is the best type of logic I could use to find this fiscal year date?

Reply when you can.
Thanks
John
 
I am not an expert, but I use this:

CHAR(case when month(transaction_year) < 4 then
year(transaction_year - 1 year)
else year(transaction_year) end)
 
Hello John,

We are in a similar situation, but in our case we have an off-set for one month (fiscal year runs from december to november)
For fiscal year manipulation we use a special calender-file that handles the offset. Such a table is a one-time exercise, but can be used again and again for looking up fiscal year.....

T. Blom
Information analyst
tbl@shimano-eu.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top