Home » SQL & PL/SQL » SQL & PL/SQL » Diff b/w DD-Mon-YY and DD-Mon-RR (9.0.4.0)
Diff b/w DD-Mon-YY and DD-Mon-RR [message #346297] Mon, 08 September 2008 02:30 Go to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member

Please let me know the difference between
"DD-Mon-YY" and "DD_Mon-RR" formats.

Thank you
Re: Diff b/w DD-Mon-YY and DD-Mon-RR [message #346299 is a reply to message #346297] Mon, 08 September 2008 02:34 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
One is "DD-Mon-YY", the other is "DD_Mon-RR".
Re: Diff b/w DD-Mon-YY and DD-Mon-RR [message #346300 is a reply to message #346297] Mon, 08 September 2008 02:37 Go to previous messageGo to next message
dwarak.k
Messages: 61
Registered: June 2008
Location: Hyderabad
Member
Look at RR date format here

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#i34924
Re: Diff b/w DD-Mon-YY and DD-Mon-RR [message #346302 is a reply to message #346299] Mon, 08 September 2008 02:39 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member

It's my mistake..

"dd-mon-yy" and "dd-mon-rr".

Thank you.
Re: Diff b/w DD-Mon-YY and DD-Mon-RR [message #346304 is a reply to message #346302] Mon, 08 September 2008 02:43 Go to previous messageGo to next message
dwarak.k
Messages: 61
Registered: June 2008
Location: Hyderabad
Member
Quote:

The RR Datetime Format Element

The RR datetime format element is similar to the YY datetime format element, but it provides additional flexibility for storing date values in other centuries. The RR datetime format element lets you store 20th century dates in the 21st century by specifying only the last two digits of the year.

If you use the TO_DATE function with the YY datetime format element, then the year returned always has the same first 2 digits as the current year. If you use the RR datetime format element instead, then the century of the return value varies according to the specified two-digit year and the last two digits of the current year.

That is:

If the specified two-digit year is 00 to 49, then

If the last two digits of the current year are 00 to 49, then the returned year has the same first two digits as the current year.

If the last two digits of the current year are 50 to 99, then the first 2 digits of the returned year are 1 greater than the first 2 digits of the current year.

If the specified two-digit year is 50 to 99, then

If the last two digits of the current year are 00 to 49, then the first 2 digits of the returned year are 1 less than the first 2 digits of the current year.

If the last two digits of the current year are 50 to 99, then the returned year has the same first two digits as the current year.

The following examples demonstrate the behavior of the RR datetime format element.

RR Datetime Format Examples

Assume these queries are issued between 1950 and 1999:

SELECT TO_CHAR(TO_DATE('27-OCT-98', 'DD-MON-RR') ,'YYYY') "Year"
FROM DUAL;

Year
----
1998

SELECT TO_CHAR(TO_DATE('27-OCT-17', 'DD-MON-RR') ,'YYYY') "Year"
FROM DUAL;

Year
----
2017

Now assume these queries are issued between 2000 and 2049:

SELECT TO_CHAR(TO_DATE('27-OCT-98', 'DD-MON-RR') ,'YYYY') "Year"
FROM DUAL;

Year
----
1998

SELECT TO_CHAR(TO_DATE('27-OCT-17', 'DD-MON-RR') ,'YYYY') "Year"
FROM DUAL;

Year
----
2017

Re: Diff b/w DD-Mon-YY and DD-Mon-RR [message #346306 is a reply to message #346304] Mon, 08 September 2008 02:49 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member

Dwarak,

Thank you very much for your clear explanation...

Re: Diff b/w DD-Mon-YY and DD-Mon-RR [message #346307 is a reply to message #346304] Mon, 08 September 2008 02:51 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It is better to post a link that just quoting the documentation.

Regards
Michel
Re: Diff b/w DD-Mon-YY and DD-Mon-RR [message #346324 is a reply to message #346307] Mon, 08 September 2008 04:02 Go to previous message
dwarak.k
Messages: 61
Registered: June 2008
Location: Hyderabad
Member
I had posted the link in my earlier post. Saw the response of OP thought my link was broken. My Bad Sad
Previous Topic: System hang
Next Topic: Timestamps and Hell.....
Goto Forum:
  


Current Time: Fri Dec 09 23:05:32 CST 2016

Total time taken to generate the page: 0.13090 seconds