How to get first day of the last 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
pavans
Participant
Posts: 116
Joined: Sun Sep 10, 2006 7:33 am
Location: bangalore, india

How to get first day of the last month

Post by pavans »

Hi
I have two columns where i need to load as :
TARIH1 = first day of the last month
TARIH2 = last day of the last month.

any help appreciated.

Thanks in advance.
Thanks,
Pavan
uppalapati2003
Participant
Posts: 70
Joined: Thu Nov 09, 2006 2:14 am

Re: How to get first day of the last month

Post by uppalapati2003 »

Hi pavan,

Please take all these stage variables and pass the required Stagevariables to output columns:

MonthDayFromDate(CurrentDate())= stageVariable1
DateFromDaysSince(- stageVariable1,CurrentDate())=stageVariable2
DateFromDaysSince(- 1, stageVariable2)stageVariable3
MonthDayFromDate(stageVariable3)=stageVariable4
DateFromDaysSince(- stageVariable4,stageVariable2)stageVariable5


stageVariable2 gives lastday in the previous Month.
DateFromDaysSince(- stageVariable1,CurrentDate())=stageVariable2

stageVariable5 gives the FirstdayinLastmonth
DateFromDaysSince(- stageVariable4,stageVariable2)=stageVariable5
Srini
Post Reply