date type??

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
info_ds
Charter Member
Charter Member
Posts: 88
Joined: Thu Feb 10, 2005 4:36 am
Location: B\'lore

date type??

Post by info_ds »

hi everybody,
how to find difference between two dates using Datastage
i.e expecting output in terms of days
plz do needful
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hello Info_DS,

DataStage internal representation of dates is in a number of days since 31/12/1967. So if you have two dates in text format, i.e. "1 jan 2005" and "8 Feb 2005", you would simply do a mathematical formula on the internal values in a transform (or in a function/routine if you wish):

Code: Select all

ICONV({LaterDate},"D4")-ICONV({EarlierDate},"D4")

and the result is the integer number of days between the two. The "D4" format is dependant upon the input format, but you can read up on the possibilities in the DataStage documentation.
billsklar
Participant
Posts: 17
Joined: Tue Jul 13, 2004 9:42 am

Post by billsklar »

Another option might be to use the datediff function in your custom SQL.
Post Reply