Date Difference in Months

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
srikanthd1978
Charter Member
Charter Member
Posts: 38
Joined: Wed Mar 17, 2004 1:16 am
Location: USA

Date Difference in Months

Post by srikanthd1978 »

people,

I need to get the diffrence between 2 date fields in Months..I can use the Xfm..but cannot use any user defined Qry..or touch any DB table...

If the difference in Months is > 60..i need to set a Flag else Unset it..

The functionality shld be similar to something like

If

TIMESTAMPDIFF(64, CHAR(TIMESTAMP_ISO(CURRENT TIMESTAMP) - TIMESTAMP_ISO(a.Date_Field))) > 60 then 'Y' else 'N'

In DB2..

any ideas...

thanks.
..i did not invent many things..but i can make them Better..
RobertScarbrough
Participant
Posts: 24
Joined: Fri Oct 01, 2004 1:43 pm
Location: USA

Re: Date Difference in Months

Post by RobertScarbrough »

This may help.

viewtopic.php?t=92392
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This one may be easier to do - assuming that the 60 is fixed - to get the difference in years. 60 months is always 5 years, irrespective of leap years and other confounding factors.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply