How to get end of month date in progress 4gl

progress-4gl

Solution

/* the last day of this month is one day less than the first day of next month
 *
 * so add one month to the first day of this month and then subtract one day.
 *
 */

function lastDay returns date ( input d as date ):

  return add-interval( date( month( d ), 1, year( d )), 1, "month" ) - 1.

end.

Problem

How can I get the last day of the month in progress 4gl?

Original source