Date difference in Years with Leap year consideration

I need some code which does the date difference ( in Years or months) taking Leap years into consideration.

I did my part of google and this forum search, so anybody who had done this before in either formulas or Lotusscript please let me know.

Any help appreciated,

Thanks,

Durga

Subject: Simple One

Here is a simple one and is not exact to whether the day of the ending month is before or after the day of the starting month.

==================================

startdate := [10/08/1995];

enddate := [03/02/2007];

sdmonth := @Month(startdate);

sdyear := @Year(startdate);

edmonth := @Month(enddate);

edyear := @Year(enddate);

@If(sdmonth <= edmonth;

@Text(edyear - sdyear) + " year(s) and " + @Text(edmonth - sdmonth) + " month(s)"; 

@Text(edyear - sdyear - 1) + " year(s) and " + @Text(12-(sdmonth - edmonth)) + " month(s)"

) 

==================================