February is always a problem in that its last day depends on whether the year is leap or not. XpressDox has the LastDayInMonth function to assist with this.
All that is required is to provide the function with a date and it will return the last day of the month in which that date occurs.
Some examples:
«
LastDayInMonth(Today())
»
On 12 August 2017, or any day in August 2017, this would return “2017-08-31”.
«
FormatDate(LastDayInMonth(PeriodEndDate),'MMMM dd, yyyy')
»
If PeriodEndDate was a date in February 2016, then the result would be “February 29, 2016”.
If PeriodEndDate was a date in February 2017, then the result would be “February 28, 2017”.