views:

47

answers:

1

I have a date in the format of:

27-MAY-09 12.00.00.000000 AM

I want to convert it to:

05/27/2009

I did to_char(my_date_variable, 'MM/DD/YYYY') however that gives me character to number conversion error

what can I do to convert this date?

my_date_variable is declared as:

my_date_variable VARCHAR2(40);
+1  A: 

You must first convert my_date_variable from VARCHAR2 to TIMESTAMP:

to_char(to_timestamp(my_date_variable), 'MM/DD/YYYY')
Adam Paynter
better off using an explicit format mask in the to_timestamp(my_date_var,'dd-mon-rr hh.mi.ss.ff6 am')
Gary