Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function to calculate months
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01516271
Message ID:
01516277
Vues:
47
>No, let's say that your data starts January 1, 2011, and ends on March 17, 2011. We both know that this covers January, Febraury adn March, so it's three months.
>
>So, if you had :
>
>StartDate = DATE(2011,01,01)
>EndDate = DATE(2010,03,17)
>?MONTH(EndDate)-MONTH(StartDate)
>
>it would only show a value of 2, meaning two months, but it actually covered a partial month for a 3rd month.

My question was a bit more complex, say,

Your start date is Jan. 20 and end date is March 20. How many months?

I was thinking you can do

select count(month(Date))
group by month(date)

to get the number of months (even partial months).
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform