Page 1 of 1

date type??

Posted: Fri Feb 11, 2005 4:41 am
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

Posted: Fri Feb 11, 2005 4:51 am
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.

Posted: Fri Feb 11, 2005 12:30 pm
by billsklar
Another option might be to use the datediff function in your custom SQL.