Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function to determine age, with part years?
Message
 
 
À
01/12/2010 16:29:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01491452
Message ID:
01491457
Vues:
69
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform