Adding months to Date in Server Edition

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sridharvg
Participant
Posts: 17
Joined: Wed Jul 19, 2006 3:19 am
Location: Hyderabad, India
Contact:

Adding months to Date in Server Edition

Post by sridharvg »

Hi,

Can you please tell us how to add months to Date format in Server Edition using OCONV(ICONV....

Thanks in Advance,
Sridhar.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Depends on your definition of 'month'. Typically, you either add a number of days to the date or break it up into component pieces and bump the month (and perhaps year and day) individually. Both Ray and Ken have routines to do this available for download, from what I recall.
-craig

"You can never have too many knives" -- Logan Nine Fingers
test
Participant
Posts: 5
Joined: Tue Nov 21, 2006 12:46 am

Re: Adding months to Date in Server Edition

Post by test »

[quote="sridharvg"]Hi,

Can you please tell us how to add months to Date format in Server Edition using OCONV(ICONV....

Thanks in Advance,
Sridhar.[/quote]


Hi
you can try this..
First Convert the date to month format..
like Oconv(date(),"D-M") result is 1 or 2 or ...12 based on the system date
For Eg:today's date 26-11-2008---->11

then add the number i.e., which month u want the date to be..


Like if u need DEC then add 1


Finally the expression will be

OConv(IConv(Oconv(date(),"D-M")+1),"D-M"),"D-YMD[4,2,2]")

I guess..this gives you the 1st dec date
test
Participant
Posts: 5
Joined: Tue Nov 21, 2006 12:46 am

Re: Adding months to Date in Server Edition

Post by test »

[quote="sridharvg"]Hi,

Can you please tell us how to add months to Date format in Server Edition using OCONV(ICONV....

Thanks in Advance,
Sridhar.[/quote]


Hi
you can try this..
First Convert the date to month format..
like Oconv(date(),"D-M") result is 1 or 2 or ...12 based on the system date
For Eg:today's date 26-11-2008---->11

then add the number i.e., which month u want the date to be..


Like if u need DEC then add 1


Finally the expression will be

OConv(IConv(Oconv(date(),"D-M")+1),"D-M"),"D-YMD[4,2,2]")

I guess..this gives you the 1st dec date
test
Participant
Posts: 5
Joined: Tue Nov 21, 2006 12:46 am

Re: Adding months to Date in Server Edition

Post by test »

[quote="sridharvg"]Hi,

Can you please tell us how to add months to Date format in Server Edition using OCONV(ICONV....

Thanks in Advance,
Sridhar.[/quote]


Hi
you can try this..
First Convert the date to month format..
like Oconv(date(),"D-M") result is 1 or 2 or ...12 based on the system date
For Eg:today's date 26-11-2008---->11

then add the number i.e., which month u want the date to be..


Like if u need DEC then add 1


Finally the expression will be

OConv(IConv(Oconv(date(),"D-M")+1),"D-M"),"D-YMD[4,2,2]")

I guess..this gives you the 1st dec date
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You guess? Ironic question, but did you test this?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try the AddMonths routine from here
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply