Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Y2K QUESTION automatic conversion

Re: Y2K QUESTION automatic conversion

From: Thomas Pall <tpall_at_bga.com>
Date: 14 May 98 14:40:09 GMT
Message-ID: <355b0249.0@feed1.realtime.net>


You might want to use Oracle's Y2k windowing (if 2nd half century, 19, if first half century, 20) like this instead:

update ... set the_date=to_date('30/01/01', 'DD/MM/RR') where ....;

commit;

select to_char(the_date, 'DD/MM/YYYY') from ... where ....;

TO_CHAR(THE_DATE,'DD/MM/YYYY')



30/01/2001

Tom Pall,
Oracle consultant, currently creating a Y2K tracking database which had better be Y2K compliant ;-)

Steve Cosner (stevec_at_zimmer.csufresno.edu) wrote:
: In article <354FB25D.17E4_at_dsp35001.ca.boeing.com>,
: Doug Henderson <dough_at_dsp35001.ca.boeing.com> wrote:
: >A Y2K-related question about automatic conversion of data types:
: >
: >I understand that Oracle automatically converts a CHAR string to DATE
: >if the CHAR string is in the "default Oracle" (i.e., DD-MON-YY)
: >format. So, an insert like the following will work in SQL*PLUS:
: >
: >INSERT INTO some_table (st_date) /* st_date is a DATE column */
: >VALUES '05-MAY-98';
: >
: >The year for the date inserted by the above statement will end up
: >as 1998 in the database.
: >
: >My question is, will such automatic conversion work correctly after
: >1/1/2000? In other words, will the century portion of the year for
: >such an insert automatically be the 21st century after 1/1/2000?

: Yes it will work. What I have found is that if you do not specify the
: century in a date, the century gets set to the century of the date on
: the client.

: But I think you should beware: What if your user needs to insert a
: future or prior date that is in a different century? If you enter
: 05-JAN-00 now, it will be stored as 05-JAN-1900. And after
: 01-JAN-2000, if you enter 01-DEC-99, it will be stored as 01-DEC-2099.

: Your approach will ONLY work if all the dates entered are for the
: current day!

: Regards,
: Steve Cosner

-- Received on Thu May 14 1998 - 09:40:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US