Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get the number of months between 2 dates ?
Message
 
À
25/11/1999 10:23:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00295544
Message ID:
00295548
Vues:
34
>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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform