>Hi all,
>
>Does anyone have a bulletproof function to determine "age" between 2 dates - that takes into account leap years and also is able to report back part years (as a decimal part of the number) e.g. 21.3671 for 21 years and 134 days into the next year.
>
>I wrote one years ago that loops through the years between the start date and end date adjusting for leap years and it works for the most part. It slows the report down somewhat as it is called a few hundred times and has to run this loop each time.
>
>The customer wants it to be "accurate" for the decimal part so that if it was 134 days into the new years and that year is not a leap year, it would return .3671 for the decimal portion (134/365) and if it *was* a leap year, it would return .3661 (134/365). Not sure their "logic" on that last bit is "correct" but that's what they want.
>
>So in short, a faster function than a loop would be good as long as it can return days as a decimal fraction.
>
>thanks,
>Albert Gostick
See
Re: Calculate age in months Thread #
1456276 Message #
1456280
If it's not broken, fix it until it is.
My Blog