Page 1 of 1

GoBack in Date and Time

Posted: Fri Jun 17, 2005 9:51 am
by Raftsman
It there a way to go back in date and time. I have a record thay contains

01-04-2004 01:30:00 and I want to decrease it by 3 hours

The result would be 31-03-2004 10:30:00

Is there a function to do this. I am using ICONV and OCONV but I am wondering if there is an internal value for date and time combined to subtract from.

Could someone please help.

Thanks

Posted: Fri Jun 17, 2005 10:11 am
by ArndW
Hello Raftsman,

DataStage internally stores the date as an integer and the internal format for time is also an integer (number of seconds since midnight); there is no unified single timestamp format. One needs to program a small routine to take care of date addition and subtraction. It wouldn't be too difficult to make your own format - i.e. seconds since a given date. So you could store numbers easily in floating point by doing a ICONV(<date>,<fmt>)*60*60*24 and then adding ICONV(<time>,'MTS') to it. Reconverting back to a correct date and time is a function MOD with 86400 and so on. I think I've seen a posting here with a good function to do date/time addition and subtraction.

Posted: Fri Jun 17, 2005 5:31 pm
by ray.wurlod
There is no out-of-the-box function.

Search the forum as Arnd suggested; yours is far from a unique problem.