How to get end of month date in progress 4gl

Daria Trainor picture Daria Trainor · Jun 19, 2012 · Viewed 11.9k times · Source

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

Answer

Tom Bascom picture Tom Bascom · Jun 19, 2012
/* 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.