Improve a difference between two dates
Posted: Thu Apr 12, 2007 4:34 am
Hi to everyone,
I've a problem with a difference between two dates.
I have improved a lookup between an oledb stage (sserver 2005) and an hashed file previously filled in another job with data get from a sql server table.
In the transformer where I perform the lookup, I need to obtain a difference (in days) between two dates (the former is from the oledb stage and the latter from the hashed file).
The two dates have the same format, that is datetime in sql server and become timestamp in datastage. (i.e. 2007-01-15 00.00.0..)
I'm trying to use the function DateGenericDateDiff(%date1%,%date2%) but I don't obtain valuable results (only impossible date/time conversion warnings)
Could you suggest me where is the problem? Thanks a lot for any help.
I tried unsucccessfully:
DateGenericDateDiff(lnk1.startDate,lnk2.endDate)
DateGenericDateDiff(lnk1.startDate[1,10],lnk2.endDate[1,10])
And as test:
DateGenericDateDiff("20070101", "20070401")
DateGenericDateDiff(Oconv(Iconv("01012007","D MDY[2,2,4]"),"D-YMD[4,2,2]"), Oconv(Iconv("04012007","D MDY[2,2,4]"),"D-YMD[4,2,2]"))
I've a problem with a difference between two dates.
I have improved a lookup between an oledb stage (sserver 2005) and an hashed file previously filled in another job with data get from a sql server table.
In the transformer where I perform the lookup, I need to obtain a difference (in days) between two dates (the former is from the oledb stage and the latter from the hashed file).
The two dates have the same format, that is datetime in sql server and become timestamp in datastage. (i.e. 2007-01-15 00.00.0..)
I'm trying to use the function DateGenericDateDiff(%date1%,%date2%) but I don't obtain valuable results (only impossible date/time conversion warnings)
Could you suggest me where is the problem? Thanks a lot for any help.
I tried unsucccessfully:
DateGenericDateDiff(lnk1.startDate,lnk2.endDate)
DateGenericDateDiff(lnk1.startDate[1,10],lnk2.endDate[1,10])
And as test:
DateGenericDateDiff("20070101", "20070401")
DateGenericDateDiff(Oconv(Iconv("01012007","D MDY[2,2,4]"),"D-YMD[4,2,2]"), Oconv(Iconv("04012007","D MDY[2,2,4]"),"D-YMD[4,2,2]"))