0

How to get the difference of the month from the date specified.
Example:

date1.value="5/1/2010"
date2.vale ="5/31/2011"

it should give a result of 12.

thank you for helping.!

Edited by blocker: n/a

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by blocker
0
Dim resultdate As Long

        resultdate = DateDiff(DateInterval.Year, date2, date1)

Try this...

0

Sorry u need months right? try this

resultdate = DateDiff(DateInterval.Month, date1, date2)

0

Sorry u need months right? try this

resultdate = DateDiff(DateInterval.Month, date1, date2)

Thanks. But i got these error!

"Object required" even if the name of the date control is correct..

msgbox datediff(dateinterval.month,dt1.value,dt2.value)
0

Thanks. But i got these error!

"Object required" even if the name of the date control is correct..

msgbox datediff(dateinterval.month,dt1.value,dt2.value)

I got it.. These works!

dim getmonthdiff as long

getmonthdiff=datediff("m",dt1,dt2)

msgbox getmonthdiff

thx..

Edited by blocker: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.