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!

Calculating Number of days from a date to end of current month 1

Status
Not open for further replies.

DeviousDi

MIS
May 23, 2013
57
GB
Hi,

Trying to write a query that will give me the number of days between the query date of an invoice, and the end of the current month.

I'm stuck on the last part of the query:

datediff("d", invoice.query_date, last day of month)

Is there a piece of code in Crystal XI that will do this for me? I've found nothing anywhere!

Thank you

Di
 
You need to determine month end first

@Monthend
dateadd("m", 1, date(Year(currentdate), Month(currentdate), 01))-1

Use this formula for the last day of month in your formula

Ian
 
Thanks, its worked a treat!

Its a handy piece of code, shall add it to my growing list!

Di
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top