Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Function to calculate months
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01516271
Message ID:
01516277
Views:
46
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform