Re: FORMS 3.X - SYSDATE calculation problem
From: Karg Michael <karg_at_uranus.tuwien.ac.at>
Date: 1997/04/23
Message-ID: <335DCD8C.3CA4_at_uranus.tuwien.ac.at>#1/1
Date: 1997/04/23
Message-ID: <335DCD8C.3CA4_at_uranus.tuwien.ac.at>#1/1
mcgrathm_at_admin1.tcd.ie wrote:
>
> Hi,
>
> I'm doing a date calculation in ver. 3.x forms that is to
> find the exact date 4 yrs ago e.g.
>
> if today = 22-Apr-1997 then
> 4 yrs ago = 22-Apr-1993.
>
> I've tried a few fixes including
>
> sysdate - (4 * 365) (leap yrs )
>
> to_char(sysdate,'yyyy') - 4.
>
> I would be interested in hearing from anyone else with a solution to this
> puzzle.
>
> TIA,
>
> Michael.
You have to use this:
TO_DATE(TO_CHAR(SYSDATE,'DD.MM')||'.'|| TO_CHAR(TO_NUMBER(TO_CHAR(SYSDATE,'YYYY'))-4),'DD.MM.YYYY')
Hope it helps
-- ---------------------------------------------------------- IMSoft - Dipl.-Ing. Michael Karg Graf Starhemberggasse 32/2/3 1040 Wien Austria ---------------------------------------------------------- e-mail : karg_at_uranus.tuwien.ac.at michael.karg_at_bigfoot.com +436641015732_at_text.mobilkom.at Tel & Fax: ++43/1/5056190 A1 : ++43/664/1015732 WWW : http://uranus.tuwien.ac.at/~karg/imsoft.html http://titania.tuwien.ac.at/~karg/imsoft.htmlReceived on Wed Apr 23 1997 - 00:00:00 CEST