Reputation: 7
I have a oracle form that the user loads data. The date format the user uses is different than what I have in my list of values. Need help in adding this format
SELECT
TO_CHAR(TO_DATE( 'Sunday, November 4, 2018', 'DD MON YYYY' ))
FROM
DUAL;
Convert to '11/4/2018'
.
Upvotes: 0
Views: 277
Reputation: 222672
You can convert a string like 'Sunday, November 4, 2018'
to a DATE
datatype with this expression:
TO_DATE( 'Sunday, November 4, 2018', 'Day, Month DD, YYYY' )
Then it is possible to convert the date to a string in another format with TO_CHAR()
.
You seem to be looking for:
SELECT
TO_CHAR(TO_DATE( 'Sunday, November 4, 2018', 'Day, Month DD, YYYY' ), 'MM/DD/YYYY')
FROM DUAL;
This yields:
11/04/2018
Upvotes: 1