Formatting a char field to date
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Formatting a char field to date

  1. #1
    Join Date
    Oct 2002
    Posts
    4
    Hi,

    The time is stored in a varchar2 field as "1603", I would like to format it to display "4:03pm" in the output.

    I used the to_date function and I got this error:
    (ORA-01849: hour must be between 1 and 12).

    Please help.

    Thanks

    Mo
    Mo

  2. #2
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    Hi,
    select to_char(to_date('1603','hh24:mi'),'hh:miam') from dual;
    Ales
    The whole difference between a little boy and an adult man is the price of toys

  3. #3
    Join Date
    Oct 2002
    Posts
    4
    Thanks a lot, that worked.
    Mo

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