Page 1 of 1

Date Difference in Months

Posted: Fri Sep 30, 2005 1:28 pm
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.

Re: Date Difference in Months

Posted: Fri Sep 30, 2005 2:03 pm
by RobertScarbrough
This may help.

viewtopic.php?t=92392

Posted: Fri Sep 30, 2005 5:58 pm
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.