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

Home -> Community -> Usenet -> c.d.o.misc -> Re: ORACLE Date Ranages and Y2K Bug

Re: ORACLE Date Ranages and Y2K Bug

From: Van Messner <vmessner_at_netaxis.com>
Date: Fri, 18 Dec 1998 17:23:18 -0500
Message-ID: <2FAe2.8768$WM6.6138@news6.ispnews.com>


If you want to use four-digit years (and you should) try using RRRR as the year format. This is a good interim step that allows both two and four digit year input to work while you head in the direction of YYYY eventually. Then all you have to worry about is when the phone company needs to go to four digit area codes.

Van

fumi wrote in message <75d8fm$s1a$2_at_news.seed.net.tw>...
>
>dloper_at_my-dejanews.com ¼¶¼g©ó¤å³¹ <759oie$jfb$1_at_nnrp1.dejanews.com>...
>>I am working on some reports that have user defined date ranges. I am
>trying
>>to Y2K proof them. I have succeeded in using the MM/DD/RR date format. I
>can
>>get the data when the date ranges are within the same century.
>>
>> Example:
>> From Date: 12/01/1998 To Date: 12/31/1999
>> From Date: 01/01/2000 To Date: 01/31/2001
>>
>>These date ranges work fine. The problem developes when I input a date
>range
>>in like the following: From Date: 12/01/1998 To Date: 01/31/2001
>>
>>The program can't find the transactions when I cross the into the year
2000
>>from the 1900's.
>>
>>Has anyone ever come up against this problem? I would appreciate any help
>you
>>can give.
>
>
>
>There is nothing wrong with date format 'MM/DD/RR'.
>I think, the only possibility is your misusage on date data type.
>
>The following scrpit show it:
>
>SQL> create table test_d (d date);
>
>Table created.
>
>SQL> begin
> 2 for i in 1..100 loop
> 3 insert into test_d values (sysdate+i*10);
> 4 end loop;
> 5 end;
> 6 /
>
>PL/SQL procedure successfully completed.
>
>SQL> alter session set nls_date_format='MM/DD/RR';
>
>Session altered.
>
>SQL> select * from test_d where d between '12/01/98' and '01/31/01';
>
>D
>--------
>12/27/98
>....[snip]
>01/15/01
>01/25/01
>
>77 rows selected.
>
>
>See, Oracle finds the result correctly across year 2000.
>
>
Received on Fri Dec 18 1998 - 16:23:18 CST

Original text of this message

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