Hi,
I have one date column in my source table. The date i need to calculate based on four quarter months basis. Means 1st quarter - Jan to Mar 2nd Quart-Apr to Jun 3rd Quart-July to Sep 4th Quart-Oct to Dec.
If my source date comes between first quarter like this Ex: 3/14/2005 then my First Date should be 1/1/2005 and End Date Should be 12/31/2005 and if my source date comes between 2nd quarter like 4/2/2006, then my First Date should be 4/1/2006 and End Date Should be 3/31/2007.
Show me a right direction how to achieve this.
Need Logic...
Moderators: chulett, rschirm, roy
Need Logic...
prabakaran.v
You can use the substring or left function and fetch the first character of your date field. Then based on that, you can default the date to the required date.
For eg:
a. if your input date is '3/14/2005', then your substr or left function will give the reply as '3', then you can default the date with 1/1/2005.
b. Once your month & date part is done, you can append the year depending on the input date value using right, substr, year functions
This is just a logic to go around... you might have to do some trial & error with the logic.
Regards,
Divya
For eg:
a. if your input date is '3/14/2005', then your substr or left function will give the reply as '3', then you can default the date with 1/1/2005.
b. Once your month & date part is done, you can append the year depending on the input date value using right, substr, year functions
This is just a logic to go around... you might have to do some trial & error with the logic.
Regards,
Divya
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
Int((MonthFromDate(InLink.TheDate)-1)/3)+1
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.