Re: Y2K query - Forms 3.0

From: Christian Mondrup <reccmo_at_sc03.sctp.dk>
Date: 29 Apr 1998 13:09:18 GMT
Message-ID: <6i78pu$qrm$2_at_news.net.uni-c.dk>


[Quoted] Eddie Fung <iggster_at_netspace.net.au> wrote:
: We are Y2K repairing a Forms 3.0 application and have date fields
: which are using DD/MM/YY format masks. When we have date fields of
: 20nn on the database they appear as DD/MM/nn on the screen but they
: (the screen fields) seem to be containing 19nn rather than 20nn
: despite the fact that they are in the 21st rather than 20th century.

: It would appear that Forms 3.0 is 'defaulting' the century.

: Has anyone else out there come across this and if so what did they do
: (other than expanding the field to use a YYYY format) ?

Years ago someone who's name I don't remember posted some code that I used for this procedure:

   DEFINE PROCEDURE

      NAME = fix_century
      DEFINITION = <<<
      FUNCTION fix_century (date_in IN DATE)  RETURN DATE IS
        yy CHAR(2) := TO_CHAR(date_in, 'yy');
        -- yy is the 2-digit year for which a century is returned.
        century CHAR(2);
        yr_yyyy NUMBER(4):=TO_NUMBER(TO_CHAR(SYSDATE,'YYYY'))-90;
        --  In Oracle Forms, we store sysdate in the form, so it
        --  only needs to be requested from the server once.
        /*
           Forces a date to contain a century within the range of 89
           years BEFORE, and 10 years AFTER the current year.  For
           example:
             In 1995, if a user enters 01-JAN-06, the function
             translates the year to 1906; in 1996, it will translate
             to 2006.  Entering 31-DEC-05 translates to 2005; 01-JAN-99
             translates to 1999.
        */
      BEGIN
        IF SUBSTR(yy,1,2) > SUBSTR(TO_CHAR(yr_yyyy),3,2) THEN
          century := SUBSTR(TO_CHAR(yr_yyyy),1,2);
        ELSE
          century := SUBSTR(TO_CHAR(yr_yyyy + 100),1,2);
        END IF;
        RETURN TO_DATE(century||TO_CHAR(date_in,'yymmdd'),'yyyymmdd');
      EXCEPTION
        WHEN others THEN
          proc_err('fix_century');
      END;
      >>>

   ENDDEFINE PROCEDURE
: thanks,

: eddie

Christian Mondrup, Computer Programmer
Scandiatransplant, Skejby Hospital, University Hospital of Aarhus Brendstrupgaardsvej, DK 8200 Aarhus N, Denmark Phone: +45 89 49 53 01, Telefax: +45 89 49 60 07 Received on Wed Apr 29 1998 - 15:09:18 CEST

Original text of this message