Datastage in Transformer Add or subtract from CurrentDate
Moderators: chulett, rschirm, roy
Datastage in Transformer Add or subtract from CurrentDate
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
Re: Datastage in Transformer Add or subtract from CurrentDat
I think convert the date(in this case Current_Date()) into julian and perform the subtraction and then convert back into date.
Benjamin