DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: to_date(SYSDATE,'DD-MON-YYYY RR')

  1. #1
    Join Date
    Apr 2001
    Location
    London
    Posts
    725
    Hi Friends,

    I am trying to work out what the 'RR' Parameter in the to_data function represents. Can anyone please explain.

    Also..

    I entered the following in sqlplus :

    select
    to_date(SYSDATE,'DD-MON-YYYY RR')
    from dual

    and got the following error

    ORA-01840: input value not long enough for date format
    anybody know why?

    What would be the correct syntax to display 'RR' as part of a date ?
    What is it ?

    Many Thanks

    Suresh



  2. #2
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    Try either one of these:

    select to_char(sysdate, 'DD-MON-RRRR') from dual;

    select to_char(sysdate, 'DD-MON-YYYY') from dual;

    to_char and not to_date

    Good luck.
    David Knight
    OCP DBA 8i, 9i, 10g

  3. #3
    Join Date
    Apr 2001
    Location
    London
    Posts
    725

    Please explain

    Hi,

    These both outputted the same result.

    Can you Please explain the difference between RRRR and YYYY

    Thanks

    Suresh

  4. #4
    Join Date
    Jul 2001
    Posts
    8
    Hi, you must try this

    to_date(sysdate,'DD-MON-RRRR')

    Greets,

    Sebastiaan

  5. #5
    Join Date
    Jul 2001
    Posts
    6
    select to_char(to_date('27-OCT-98', 'DD-MON-RR'), 'YYYY') "Year"
    from dual;

    Would return the previous century:

    Year
    ----
    1998

    On the other hand:

    select to_char(to_date('27-OCT-98', 'DD-MON-YY'), 'RRRR') "Year"
    from dual;

    Would return current century

    Year
    ----
    2098

  6. #6
    Join Date
    Mar 2001
    Posts
    78

    Cool

    Hi,
    RR code is used to round the century based on the current year and 2 digit year.
    If current year is >=50 and 2digit year is <50,it rounds to next century.
    If current year is <50 and 2digit year is>50,it rounds to previous century.
    If the current year is >=50 and 2digit year is >=50 the century remains unchanged.
    If the current year is <50 and 2digit year is <50 the century remains unchanged.

    regards

  7. #7
    Join Date
    Apr 2001
    Location
    London
    Posts
    725

    Thanks

    Cheers..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width