How to subtract one day from a timestampvalue?

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
rverharen
Premium Member
Premium Member
Posts: 34
Joined: Fri Jan 19, 2007 9:09 am
Location: Breda, The Netherlands

How to subtract one day from a timestampvalue?

Post by rverharen »

I think my question is not so difficult to answer but can anybody tell me the easiest way to subtract one day from a timestamp value?

being a little oracle minded i tried just adding -1 to the deriviation but when running the job, the job aborts.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In a server job separate the date and time portions, subtract one day from the day portion, then re-assemble the timestamp.

Code: Select all

Oconv(Iconv(Field(InLink.TheTimestamp, " ", 1, 1), "DYMD") - 1, "D-YMD[4,2,2]") : " " : Field(InLink.TheTimestamp, " ", 2, 3) 
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rverharen
Premium Member
Premium Member
Posts: 34
Joined: Fri Jan 19, 2007 9:09 am
Location: Breda, The Netherlands

Post by rverharen »

ray.wurlod wrote:In a server job separate the date and time portions, subtract one day from the day portion, then re-assemble the timestamp.

Code: Select all

Oconv(Iconv(Field(InLink.TheTimestamp, " ", 1, 1), "DYMD") - 1, "D-YMD[4,2,2]") : " " : Field(InLink.TheTimestamp, " ", 2, 3) 
I will be using it right away.
Thanks Ray.

Greetings Roy
Post Reply