Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2002
    Posts
    6

    Unanswered: oracle date format

    can i save a date in 'rrdddhh24miss' format in oracle table.

  2. #2
    Join Date
    Jan 2003
    Location
    Woking
    Posts
    107

    Re: oracle date format

    Originally posted by pvg1
    can i save a date in 'rrdddhh24miss' format in oracle table.
    Hi,
    Date is Date. There is no format for it.
    However u can view it in which ever format you want by using the to_char function.
    or whenever u select if you want to see the date in that format.
    then set your nls_date_format to 'rrdddhh24miss'

    Hope it Helps
    nn

  3. #3
    Join Date
    Apr 2003
    Posts
    7
    to be more specific than NoviceNo1 did
    date in oracle is not editable or saveable
    but you can view with the format you want by using the to_char function

  4. #4
    Join Date
    Dec 2002
    Posts
    6

    query on rrddddhh24miss format

    Originally posted by BadCluster
    to be more specific than NoviceNo1 did
    date in oracle is not editable or saveable
    but you can view with the format you want by using the to_char function
    I am running the following query in oracle

    select to_date((50030||163030),'rrdddhh24miss') from dual

    i am getting output as 1/30/1950 4:30:30 PM instead of
    1/30/2050 4:30:30 PM

    Why it is so

  5. #5
    Join Date
    May 2003
    Location
    Dublin, Ireland
    Posts
    44

    Re: query on rrddddhh24miss format

    Originally posted by pvg1
    I am running the following query in oracle

    select to_date((50030||163030),'rrdddhh24miss') from dual

    i am getting output as 1/30/1950 4:30:30 PM instead of
    1/30/2050 4:30:30 PM

    Why it is so
    According to SQL manual: if the last 2 digits of current year are < 50 and the year specified is >= 50 then 'rr' returnt previous century.

  6. #6
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: query on rrddddhh24miss format

    Originally posted by sjacek
    According to SQL manual: if the last 2 digits of current year are < 50 and the year specified is >= 50 then 'rr' returnt previous century.
    So the moral is: 'RR' format is a crutch that does the best it can. Only you know whether 50 really means 1950, 2050 or even 1850 or 2150. So rather than make Oracle guess, ALWAYS use a 4-digit year!

Posting Permissions

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