Page 1 of 1

How to subtract one day from a timestampvalue?

Posted: Wed May 23, 2007 5:41 am
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.

Posted: Wed May 23, 2007 5:58 am
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) 

Posted: Wed May 23, 2007 6:05 am
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