Adding the Month

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Adding the Month

Post by somu_june »

Hi,


I have a requirement like this . I need to add a month from input date which Iam getting as varchar (8) . For example 20071201 it must be 20080101 and it must take care of leap years also . Can some body help me in this.


Thanks,
Somaraju.
somaraju
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You will have to create your own, nothing is provided out of the box.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

FLOOR(No_Of_Months/12) will give you years to be added/subtracted and
(No_Of_Months MOD 12) will give you months to be added/subtracted

This should give you the lead to your solution. A solution to subtract months is given in this LINK, tweak this code if you want to add, won't be that difficult.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
paddu
Premium Member
Premium Member
Posts: 232
Joined: Tue Feb 22, 2005 11:14 am
Location: California

Post by paddu »

Do exact Search on "AddMonths routine" ,you may find some ways to achieve your requirement.


Paddu
Post Reply