No of months and days between 2 dates

L

Lance

hi all,
I need to calculate the number of months in between 2 dates and want to
display as "x months and y days" format. I tried using datediff, but it
gives as whole number. Hope someone can help me with this.
Thanks in advance.
 
G

Guest

You will need to use a function.
The function can be tailored to your specific needs.
For example, take two dates 3 April 2004 and 29 May 2004
Do you want to count the 3rd and and 29th and get 0 months, 56 days; ignore
one or both and get 55 or 54 days; or do you want to take a "standard month"
of 30 days and get 1 month 24 (25, 26) days?
 
R

rgrantz

This seems like it would be very difficult to do because of the difference
in days that months have; it's kind of a variable depending on which month
you call a month and which month you'd call 1/2 a month, etc. If you were
averaging 30 or 31 days, though, you could just use DateDiff divided by 30
or 31, and set the format to round however you wish. I've never used
DateDif, I've always used [Date2]-[Date1], and in this case I'd use
([Date2]-[Date1])/30 (this is assuming Date2 is always after Date1, of
course, maybe DateDiff takes that whole issue into account).


But if you're at February 20, and the second date is April 13, it's kind
of a matter of opinion as to exactly how many months that is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top