Burt Paulson
Burt Paulson

Reputation: 11

In Progress, How to calculate specific previous date based on today's date

I am just getting back into progress after 4 year layoff....I am trying to figure out the following for a report, using Progress 10.1C

I need to determine the last day of the month which is 3 months prior to todays date

Example: Today is July 1, 2013. So I need to bring in the last day of April. So current month minus 2 - then first day of that month minus 1.

thanks

Upvotes: 1

Views: 1438

Answers (1)

Tom Bascom
Tom Bascom

Reputation: 14020

function dx returns date ( input d as date ):

  define variable yx as integer no-undo.
  define variable mx as integer no-undo.

  if month( d ) >= 3 then
    mx = month( d ) - 2.
   else
    assign
      yx = 1
      mx = 10 + month( d )
    .

  return date( mx, 1, ( year( d ) - yx )) - 1.

end.

display dx( 7/1/2013 ).

Upvotes: 2

Related Questions