Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date Calculation
Message
De
28/03/2004 14:19:48
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
28/03/2004 01:54:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00890235
Message ID:
00890279
Vues:
20
>Hi All,
>
>Is there a sample code that will calculate the number of years, months and days given a total number of days?
>
>Example. 365 days -> 1 year, 0 month and 0 day
>650 days -> 1 year, 9 months & ~11 days

The most elegant way I have seen to get an integer number of years is something like this:
? int((val(dtos(date1)) - val(dtos(date2))) / 10000)
Perhaps you can adapt to month calculation, and then divide by 12 to get years.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform