0
votes

a varchar column is storing date value in table_a and it looks like '24-May-2021'

now i am trying to select to_date(varchar_column, 'DD/MM/YYYY') from table_a, but was throwing below error:

Can't parse '24-May-2021' as date with format 'DD/MM/YYYY'.

please help

1

1 Answers

2
votes

looking the the date formatting table

You should use:

select to_date(varchar_column, 'DD-MON-YYYY') from table_a;

because May is not 05 which the MM format expect, and - is not that separator you have in your data.