Page 1 of 1

subtract 1 microsecond from incoming timestamp

Posted: Thu Apr 14, 2011 4:55 am
by bhargav_dd
Hi all

In transformer I want to subtract -1 microsecond from the incoming timestamp '2011-02-24 07:53:08.266692' after comparison and I should get output as '2011-02-24 07:53:08.266691' Can you let me know how to achieve this is Datastage?

Posted: Thu Apr 14, 2011 6:59 am
by DSguru2B
Are you not able to find any db2 functions to handle this?

Posted: Thu Apr 14, 2011 4:35 pm
by ray.wurlod
Pretty straightforward. Strip off the microseconds, if non-zero subtract 1 and re-attach. If microseconds are zero use 999999 and subtract 1 from the seconds (perhaps using TimestampFromSecondsSince() function) before re-attaching.

use function TimestampOffsetByComponents

Posted: Thu Jan 25, 2018 8:07 am
by Klaus Schaefer
At least in DataStage 11.x there is a function called TimestampOffsetByComponents, which also supports microseconds to be added/subtracted in the seconds-component... :D

Cheers
Klaus