How to substract two Date in transformer's contraints

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
bhargav_dd
Premium Member
Premium Member
Posts: 57
Joined: Tue Jun 30, 2009 9:38 am

How to substract two Date in transformer's contraints

Post by bhargav_dd »

I have two DATE to be compared in transformer's constraints,

As I need to make sure whether their difference is bigger than 2 year or not,

How to write the code, seems that there is no specific function for such a purpose,
GJ_Stage
Participant
Posts: 131
Joined: Mon Oct 27, 2008 6:59 am

Post by GJ_Stage »

Hi,

Below function will help your requirement :

YearFromDate(StringToDate(DATE_FIELD,"%yyyy%mm%dd")
then compare it.
Jothi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

One methodology - DATE datatypes can be subtracted to get a difference in days, then you can check to see if that difference is > 730.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply