Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate number of months
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00694170
Message ID:
00694224
Views:
9
>Something like:
>?(year(y)+month(y)/12-year(x)-month(x)/12)*12

Would be better:
date1 = date(2003,1,1)
date2 = date(2003,8,27)
?year(date2)*12 + month(date2) - year(date1)*12 - month(date1)
But actually, both calculations are incorrect for these two dates. The return value is 7, while I think, it should be 8.

>
>>Using VFP7.
>>
>>How can I calculate the number of months between 2 dates?
>>
>>x = {^2001/08/01}
>>y = {^2002/08/31}
>>
>>Want to return 12 months. How can I do this?
>>
>>Thanks,
>>
>>Jerryt
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform