Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2012

    Unanswered: How to Convert Varchar2 to Date format(Timestamp)

    I have a date saved in varchar2 column.

    how can I convert the values into date(including Time stamp), so I can use the date to compare data.

    Ex: I have the value '20-03-2007 05:31:29', but this value is saved as varchar2.

    how can I take from this value the date '20-03-2007 05:31:29' as date format because later i need that date completely to add days, hours and minutes?

  2. #2
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 5
    Use TO_DATE function with the appropriate format mask, such as
    to_date(your_column, 'dd-mm-yyyy hh24:mi:ss')
    Note that it might fail if invalid values are entered into the table; for example, non-existent month if someone entered 03-20-2007 instead of 20-03-2007 and similar.

Posting Permissions

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