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

Months in the past 1

Status
Not open for further replies.

ganjass

Technical User
Dec 30, 2003
154
GB
CR 10

Does Dateadd return whole months from the current date or does it include the part month of the current month. ie say its 14/01/04 and i use dateadd("m",-2,currentdate) will it just return the 2 full months previous from the current date or will it include the part of this month as well. I need to use a function in record selection that brings back a previous number of months incuding the part month, any ideas.

Cheers
 
What does a part month mean, do you mean the date?

You displayed the example date but didn't bother to show what you were intending by "part month".

Try supplying technical information as opposed to text descriptions.

Crystal version
Database used
Example data
Expected output

I'd guess that it will include the part of the month if you mean the date...

-k
 
If you had this formula, dateadd("m",-2,currentdate), it would return 11/14/2003.

I suggest using the LastFullMonth constant in conjunciton with the maximum function and the dateadd function to get what you want.

Try this:
Code:
DATEADD("m",-2,Maximum(LastFullMonth)) + 1
This would return 12/01/2003. The first day of the previous 2 month period
Code:
Maximum(LastFullMonth)
This would return 01/31/2004. The last day of the previous 2 month period.


~Brian
 
Bdbreed i like your style. That worked a treat
Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top