Datastage in Transformer Add or subtract from CurrentDate

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
rbtaylor2
Participant
Posts: 1
Joined: Fri Aug 15, 2014 6:53 am

Datastage in Transformer Add or subtract from CurrentDate

Post by rbtaylor2 »

I have spent hours Googling a quickie answer to add or subtract days from a date (current date) while in transformer. I thought I would share what I found. I was lifting a Sequential file, so I could not build it in the Sql query, so I had to work with currentdate() in transformer, but it would not do a simple currentdate() -1. Then it stuck me, us DateOffsetByDays. I had to use that function then convert to timestamp because I was writing to MS SQL. StringToTimestamp( DateOffsetByDays( currentdate(),-1):' 00:00:00'). Hopefully this post might help a newbie or someone that does sequential file lift and needs to force the date to another one.
Rick Taylor
Benz
Participant
Posts: 3
Joined: Wed Feb 17, 2016 6:07 am
Location: Bangalore

Re: Datastage in Transformer Add or subtract from CurrentDat

Post by Benz »

I think convert the date(in this case Current_Date()) into julian and perform the subtraction and then convert back into date.
Benjamin
Post Reply