September 9, 2006

Why not abs[(year[date2] - year[date1])*12 + month[date2] - month[date1]] ?

This will give you the number of months between the dates as a positive number, whether date2 or date1 is greater.

Don Codling
WP 12.0.0.602
DP 2.6x
Windows XP home, SP2
512 MBytes RAM

Michael Iannantuoni wrote:

I have two date fields formatted as DMYD99/9999 and want to find the difference between them in Calendar Months.

I've come up with the following, separated out for clarity into three part by brackets:

IF YEAR[date2] = YEAR[date1] THEN MONTH[date2] - MONTH[date1] ELSE (12 - MONTH[date1]) + ((YEAR[date2] - YEAR[date1] -1) * 12) + (MONTH[date2]) ENDIF

Am I correct or is there a simpler way?

Michael

_______________________________________________
Dataperf mailing list
[email protected]
http://lists.dataperfect.nl/mailman/listinfo/dataperf

_______________________________________________
Dataperf mailing list
[email protected]
http://lists.dataperfect.nl/mailman/listinfo/dataperf

Reply via email to