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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating a number between two dates

Status
Not open for further replies.

harrietohs

IS-IT--Management
Apr 26, 2002
99
CA
Using Crystal 8.5

I am trying to construct a formula that will show me a numeric value that represents the number of months between a specific month and current month.

For example:

If the month in the date field called {date_seen} is Sept.
and the current month is November, the number I need to see is 3. Is it possible via a formula?

Thanks,

Harriet
 
Hi,
In the help files, look at the DateDiff functions..

For Instance:

Use DateDiff with the "m" parameter to find the number of months difference between two dates.

DateDiff ("m", #3/15/1999#, #7/13/1999#)

Returns 4.



You can take it from there...



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Great! One more question. I'm not sure how to represent the current month in the formula.

Harriet
 
3 is an odd answer for that, most consider it 2.

Anyway, it sounds like you always add one month, so use:

DateDiff("m", {startdate}, {enddate})+1

-k
 
Yep, I meant to type 2,not 3.

And thanks, you are amazing. I looked up DateDiff, but found it confusing until I read your post.

Giant thanks!!


Harriet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top