Oracle date formatting problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hdogg
    New Member
    • Mar 2007
    • 7

    #1

    Oracle date formatting problem

    Here is my situation:

    In the "PERIOD" column of my oracle database it is MM/DD/YY, ie 10/07/02. I need to convert that to a different oracle date format so i can filter and sort it. What can i do??

    -- Hyrum
  • rushdishams
    New Member
    • Mar 2007
    • 24

    #2
    one thing you may opt to do is keeping the column in tact but query it in your desired way so that it gives you your desired format. then you can utilize that query for other purposes.

    you can use TO_CHAR (datecolumn, 'desireddatefor mat)'. for instance, as you said your column period has the format mm/dd/yy and say you want to change it to yyyy/mm/dd then you can have it as-

    SELECT TO_CHAR (column, 'YYYY/MM/DD')
    FROM table_name;

    hope that helps you.

    Comment

    • rushdishams
      New Member
      • Mar 2007
      • 24

      #3
      or you can try to change the whole date format of oracle ( not that wise decision according to me though) by following command-

      ALTER SESSION SET NLS_DATE_FORMAT ='<my_format>';

      cheers mate!

      Comment

      Working...