Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count No. of months between dates

Status
Not open for further replies.

Sukh007

Technical User
Jul 24, 2008
16
GB
Hi Guys

I have 2 date fields A1 & A2. How can I calculate the number of months between the 2 data fields?

Thanks
 
Hi Guys

Found the answer

DateDiff ("m",{CONTACT2.UA1},{CONTACT2.UA2}).
 
Note that datediff just subtacts the month value in each field, so that the difference between date(2008,8,31) and date(2008,9,1) (one day) would return a result of one month. You might be better off using:

datediff("d",{CONTACT2.UA1},{CONTACT2.UA2})/30

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top