Print Page | Close Window

DateDiff formula

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=8057
Printed Date: 04 May 2025 at 8:56pm


Topic: DateDiff formula
Posted By: madams2
Subject: DateDiff formula
Date Posted: 19 Oct 2009 at 10:48am
Hi all. I'm trying to find the number of 'years' and 'months' between two dates. I used the DateDiff function however, the 'months' isn't showing exactly how I had planned.
My formulas are:
DateDiff("yyyy", #09/17/2009#, #06/07/2004#) and
DateDiff("m", #09/17/2009#, #06/07/2004#)
I'm getting "5 years" and "63 Months". Would really like to see "5 years" and "3 months".

Is there trick to this, or do I have to subtract the 'years' x 12 from the 'months' calculation?

Thanks



Replies:
Posted By: madams2
Date Posted: 19 Oct 2009 at 11:01am
Got it figured out!



Print Page | Close Window