Page 1 of 1

Diff between two dates in Datastage

Posted: Fri Feb 01, 2008 5:50 pm
by srn2006
How to calculate the difference between two dates in Transformer stage in Datastage? Basically, I want to find the equivalent function for SQL Server "Datediff" in Datastage. Could any one help me please?

Thanks,

Posted: Fri Feb 01, 2008 6:01 pm
by chulett
Welcome! :D

Dates need to be converted to 'internal' format first, then those two dates can simply be subtracted to get the number of days between them. Is that the unit of difference you are interested in - # of days?

The IConv function will do the conversion for you, basically:

Code: Select all

IConv(YourDate,"D-YMD")
Where the information between the two quotes is the proper date mask for your incoming date. Adjust that to match your data.

Posted: Sun Feb 03, 2008 12:28 am
by SHARAD123
The date gets converted to the datastage format, so that u may get the output in numeric format rather than as a date.

SO u can use either iconv or oconv functions depending on your needs.
Iconv- converts to the local datastage format i.e a number
OConv- converts to the date format

jus check out the help for the syntax and for the format.

Posted: Sun Feb 03, 2008 12:29 am
by SHARAD123
The date gets converted to the datastage format, so that u may get the output in numeric format rather than as a date.

SO u can use either iconv or oconv functions depending on your needs.
Iconv- converts to the local datastage format i.e a number
OConv- converts to the date format

jus check out the help for the syntax and for the format.

Posted: Sun Feb 03, 2008 3:14 am
by ray.wurlod
There's an obvious problem with SHARAD23's answer, and it is that U did not ask the question. It was asked by srn2006.

In English, the second person personal pronoun is spelled "you".