GoBack in Date and Time

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
Raftsman
Premium Member
Premium Member
Posts: 335
Joined: Thu May 26, 2005 8:56 am
Location: Ottawa, Canada

GoBack in Date and Time

Post 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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is no out-of-the-box function.

Search the forum as Arnd suggested; yours is far from a unique problem.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply