Link to home
Start Free TrialLog in
Avatar of MikeM670
MikeM670

asked on

Calculate Last Date of Month

I have this line of code where I need to find records that fall between two dates.  There is only one parameter that is supplied which is the starting date for the period.  I need to find the last date of the ending month.

Example:   Start Date = 07/01/2019   and the last date should calculate out to 09/30/2019

and "LicensePayments".paymentdate  between {?Start Date} and DATEADD(month,2,{?Start Date})

Open in new window


I'm using this as part of a command in Crystal Reports.
Avatar of Norie
Norie

You could try DateSerial.

DateSerial(Year({?Start Date}), Month({?Start Date})+3, 0)
Avatar of MikeM670

ASKER

I actually went with this.  Do you see any issue with it?

and "LicensePayments".paymentdate  between {?Start Date} and EOMonth( DATEADD(month,2,{?Start Date}))
No, to be honest I didn't realise EOMONTH was available in Crystal Reports.
Sorry I'm using sql in a command to retrieve data.  Should of explained that better.  

But now I have a reference from doing it in Crystal too!

Thanks
ASKER CERTIFIED SOLUTION
Avatar of MikeM670
MikeM670

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How can I give some points to Norie even tho I'm using my own solution?