locked
TO_CHAR did not work RRS feed

  • Question

  • User-1230161102 posted

    Hi

    In Oracle table I have a field of type varchar2 contain date values of format MM/DD/YYYY

    I need to write sql query to return the dates in DD/MM/YYYY format. I tried Select TO_CHAR(myfield, 'DD/MM/YYYY') but it gives error since the field is of type varchar2 not datetime.

    ANy help

    Thursday, December 11, 2014 2:23 AM

Answers

  • User-1230161102 posted

    it seems it works by doing the following

    To_CHAR(TO_DATE(myfield,'MM/DD/YYYY'),'DD/MM/YYYY'))

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 11, 2014 2:59 AM