Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get the number of months between 2 dates ?
Message
De
25/11/1999 10:46:17
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00295544
Message ID:
00295551
Vues:
28
Hi Evan,

>>How to get the number of months when date1 is substracted from date2?
>
>First of all it depends on what you mean by month.
>
>1) 30 days
>
>nMonths = (dDate2 - dDate1 )/30
>
>2) 28 days
>
>nMonths = (dDate2 - dDate1)/28
>
>3)Or you could calculate something like this. If someone were to ask how many calendar months have you been in business. Example: if you started your business on Jan 15 and it was now Feb 8. You might respond, I have been in business 2 months (Jan and Feb)
>
>nMonths = (year(dDate2)*12 + month(ddate2)) - (year(dDate1)*12 + month(dDate1)) + 1
>
>What is it that you are trying to calculate?


Let me give you an example. (a date always have to be the first of a given month)

So if:

Date1 is April 2000
Date2 is May 1999

I would like in this case to be able to validate that the specified period covers one year (12 months).
*******************************************************
Save a tree, eat a beaver.
Denis Chassé
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform