Built in function to add months in a date
Moderators: chulett, rschirm, roy
Built in function to add months in a date
hello all,
I am very new to DS
Is there any Inbuild function in DS to add number of months to a date so it will give the resulting date.
Example : date is 12/4/2001
if i want add 25 months in it
it should give resulting date as : 12/5/2003
So is there any inbuild function for that ?
Thanx in advance,
I am very new to DS
Is there any Inbuild function in DS to add number of months to a date so it will give the resulting date.
Example : date is 12/4/2001
if i want add 25 months in it
it should give resulting date as : 12/5/2003
So is there any inbuild function for that ?
Thanx in advance,
Ok, now I'm confused. You've been working on this over in the TX forum and now you're suddenly over here. Which is it? Are you working with a Server job or a TX job?
If Server, we can take it from here. For TX you need to get yourself back to the original thread and continue that conversation.
I almost poked my nose into it yesterday in spite of it being over there, but didn't. I don't recall anywhere where you've defined what you consider to be a month - fixed number of calendar days (30?) or are you just incrementing the month portion of the date? Something else? What are your rules for when the day portion in the target month isn't appropriate? For example, if you add 1 month to 01/31/2006 what do you want the answer to be? 02/31/2006? 02/28/2006? 03/03/2006? Explain how in your example you get from the 4th of the month to the 5th of the month.
No-one can properly help you until you properly scope your requirements.
If Server, we can take it from here. For TX you need to get yourself back to the original thread and continue that conversation.
I almost poked my nose into it yesterday in spite of it being over there, but didn't. I don't recall anywhere where you've defined what you consider to be a month - fixed number of calendar days (30?) or are you just incrementing the month portion of the date? Something else? What are your rules for when the day portion in the target month isn't appropriate? For example, if you add 1 month to 01/31/2006 what do you want the answer to be? 02/31/2006? 02/28/2006? 03/03/2006? Explain how in your example you get from the 4th of the month to the 5th of the month.
No-one can properly help you until you properly scope your requirements.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 23
- Joined: Mon Jul 04, 2005 6:25 am
Hi
Create a job with parameter as the date to which 25 months are to be added to.
Inside the job have DB2 stage or similar database stages.
Define metadata with one field and type date.
In the sql you write
Select #Parameter# + 25 Months from sysdummy1.
Or if you are using oracle
select add_months(#parameter#,25) from dual.
Put the output to a seq file.
So the file contains the month added val.
Leave the month adding logic to DB
Cheers
Manoj
Create a job with parameter as the date to which 25 months are to be added to.
Inside the job have DB2 stage or similar database stages.
Define metadata with one field and type date.
In the sql you write
Select #Parameter# + 25 Months from sysdummy1.
Or if you are using oracle
select add_months(#parameter#,25) from dual.
Put the output to a seq file.
So the file contains the month added val.
Leave the month adding logic to DB
Cheers
Manoj