Hi,
I've got [startdate] and [enddate]. I need to figure out how many months are between the two dates. This is for a billing situation. So, if the time frame is 11/1/2010 - 10/31/2011, the answer would be 12 months. I've tried all sorts of things but nothing is working. What would be the best approach for determining the total months in a period of time?
Thanks,
Leesha
Figuring number of months between two dates
-
- BronzeLounger
- Posts: 1488
- Joined: 05 Feb 2010, 22:25
-
- Administrator
- Posts: 78577
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Figuring number of months between two dates
There are 11 months and 30 days between the two dates, so I assume that you mean the duration of the entire interval from startdate up to and including enddate. That is
DateDiff("m",[startdate],[enddate]+1)
Works in a query, in the control source of a text box (if you put an = before it) and in VBA.
DateDiff("m",[startdate],[enddate]+1)
Works in a query, in the control source of a text box (if you put an = before it) and in VBA.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1488
- Joined: 05 Feb 2010, 22:25
Re: Figuring number of months between two dates
Thanks Hans! That is exactly what I meant and needed.
Leesha
Leesha