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!

Last Day of Month 1

Status
Not open for further replies.
Dec 16, 2008
83
GB
Hi

I've created the following formula to calculate the last day of the month 2 months ago in date format:

DateAdd("m",1,DateSerial((Year(currentdate)), (Month(currentdate)-2),1))-1

However it returns in DateTime format, how can i rejig this formula so it is only in date format?
 
In crystal just format it as date in the display, your default format is probably set as datetime.

Failing that

date(DateAdd("m",1,DateSerial((Year(currentdate)), (Month(currentdate)-2),1))-1)

But there is no reason to do this

Ian

 
You could also use this formula:

dateadd("m",-1,minimum(monthtodate))-1

~Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top