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: NLS-Date RR

Re: NLS-Date RR

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Thu, 15 Jul 1999 15:06:45 GMT
Message-ID: <3795ef7f.84376316@inet16.us.oracle.com>


On Thu, 15 Jul 1999 10:06:19 -0400, Doug Cowles <dcowles_at_bigfoot.com> wrote:

>Some documentation suggests that "RR" has something to do with the year
>relative to the current year. Can anyone shed some more light on how
>"RR" works? Someone
>else told me it was important for Y2K. Is the effect of NLS-Date
>essentially the
>default format of the system date if none is specified? A couple
>examples of RR would
>be of help...

from the Server Sql Reference Manual...

<quote>

The RR date format element is similar to the YY date format element, but it provides additional flexibility for storing date values in other centuries. The RR date format element allows you to store twenty-first century dates in the twentieth century by specifying only the last two digits of the year. It will also allow you to store twentieth century dates in the twenty-first century in the same way if necessary.

If you use the TO_DATE function with the YY date format element, the date value returned is always in the current century. If you use the RR date format element instead, the century of the return value varies according to the specified two-digit year and the last two digits of the current year. Table 3-16 summarizes the behavior of the RR date format element. The following example demonstrates the behavior of the RR date format element.

-------------------------------------------------------------------------------|
If the specified |                           |                                 |
two-digit year is|         0 - 49            |           50 - 99               |
-------------------------------------------------------------------------------|
If the last| 0-49| The return date is in     | The return date is in the       |
two digits |     | the current century.      | century before the current one. |
of the     |-----+---------------------------+---------------------------------|
current    |50-99| The return date is in the | The return date is in the       |

year are:  |     | century after the current | current century.                |
           |     | one.                      |                                 |
-------------------------------------------------------------------------------|

Example IV Assume these queries are issued between 1950 and 1999:

SELECT TO_CHAR(TO_DATE(’27-OCT-95’, ’DD-MON-RR’) ,’YYYY’) ”4-digit year”   FROM DUAL 4-digit year



1995

SELECT TO_CHAR(TO_DATE(’27-OCT-17’, ’DD-MON-RR’) ,’YYYY’) ”4-digit year”   FROM DUAL 4-digit year



2017

Assume these queries are issued between 2000 and 2049:

SELECT TO_CHAR(TO_DATE(’27-OCT-95’, ’DD-MON-RR’) ,’YYYY’) ”4-digit year”   FROM DUAL 4-digit year



1995

SELECT TO_CHAR(TO_DATE(’27-OCT-17’, ’DD-MON-RR’) ,’YYYY’) ”4-digit year”   FROM DUAL 4-digit year



2017

</quote>

hope this helps.

chris.

--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Jul 15 1999 - 10:06:45 CDT

Original text of this message

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