How to add one day to a Timestamp in PX

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
mattu
Participant
Posts: 11
Joined: Mon Jan 23, 2006 3:24 am

How to add one day to a Timestamp in PX

Post by mattu »

Hi Friends,
I want to add/substract one day from a giveg Timestamp in PX. Can you please give some solution/suggestions how to achive this?


Thanks in Advance.

Regards,
Mattu
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Extract the date, convert to Julian, add 1, convert back to date and re-assemble the timestamp.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
arnabdey
Participant
Posts: 50
Joined: Wed Jan 10, 2007 5:56 am

Using Julian date

Post by arnabdey »

You can use this

StringToTimestamp(DateFromJulianDay((JulianDayFromDate(Left(DSLink3.timstm, 10))+1)):Right(DSLink3.timstm,9))

where DSLink3.timstm is the input timestamp.
Arnab
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Only if the source timestamp is a string. What if it's really a timestamp? The OP was unclear on this point, which is why my solution was couched in general terms.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
arnabdey
Participant
Posts: 50
Joined: Wed Jan 10, 2007 5:56 am

Post by arnabdey »

Hi Ray

I had tried this in a job and then posted. It's input format is timestamp only, in the form yyyy-mm-dd hh:mm:ss. Now this format can be set at project level as well as job level.

Thanx
Arnab
Post Reply