Re: forms 3.0/difference bet dates
Date: 1997/03/14
Message-ID: <5gbjib$o2u_at_bioalp.biobase.dk>#1/1
mcgrathm_at_admin1.tcd.ie wrote:
: Hi ,
: I wonder can I share a development problem I've run into with forms 3.x.
: A form has to automatically calculate the number of years and months
: between two dates e.g. between 13-MAR-1997 AND 13-MAR-1998 would
: be represnted as 01.00 (YY.MM). The difference between 13-mar-97
: and 13-apr-1997 would be 00.01.
: I've been unable to develop a script/procedure to solve this
: problem and wonder has anyone else encountered a simliar problem
: ?
: TIA,
: Michael.
Try something like
DEFINE PROCEDURE
NAME = year_months
DEFINITION = <<<
FUNCTION year_months(date1 IN DATE, date2 IN DATE) RETURN CHAR IS
years NUMBER; months NUMBER; BEGIN months := MONTHS_BETWEEN(date1, date2); years := TRUNC(months/12); months := TRUNC(MOD(months,years*12)); RETURN TO_CHAR(years,'09')||'.'||TO_CHAR(months);END;
>>>
ENDDEFINE PROCEDURE
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Christian Mondrup + + Computer Programmer + + Scandiatransplant, Skejby Hospital, University Hospital of Aarhus + + Brendstrupgaardsvej + + DK 8200 Aarhus N + + Denmark + + + + Phone: +49 89 49 53 01 + + Telefax: +45 89 49 60 07 + + E-Mail: scancm_at_biobase.dk + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Received on Fri Mar 14 1997 - 00:00:00 CET