dateformat question Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: dateformat question

  1. #1
    Join Date
    Dec 2002

    dateformat question

    Hi All

    I have a varchar2 variable where i get the date which i need
    to store in date column of a table

    the varchar2 value is coming like this

    dt_val := 'Wed Feb 18 07:00:00 IST 2004',

    now i need to convert this into this date format
    'dd/mon/yyyy hh:mi:ss am' and insert into a table

    How to acheive this


  2. #2
    Join Date
    Dec 2000
    Ljubljana, Slovenia
    To inserted such strings into date column you would use:
    INSERT INTO my_table(my_date_col) VALUES
    (TO_DATE('Wed Feb 18 07:00:00 IST 2004',
             'Dy Mon dd hh24:mi:ss "IST" yyyy');
    To display such stored date in format you want for output, you would use:
    SELECT TO_CHAR(my_date_col, 'dd/mon/yyyy hh:mi:ss am')
    FROM my_table;
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

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