Reputation: 93
I'm selecting a series of columns to place in a new table. One of these columns (EPISTART_RAW
) is a date variable that is currently listed as a raw number, such as 13042015
and 01010216
. What I'd like to do is convert these numbers according to a sensible date format, such as 13-APR-15
and 01-JAN-16
.
I'm working through various examples I'd found online, but struggling.
Upvotes: 0
Views: 297
Reputation: 64
Date value should be within quote:
select to_date(to_char('01010216'),'DDMMYYYY') dt from dual
Upvotes: 0
Reputation: 1269463
I believe you just want to_date()
:
select to_date(EPISTART_RAW, 'DDMMYYYY')
If it is actually stored as a number, you need to handle initial zeros, so:
select to_date(to_char(EPISTART_RAW, '00000000'), 'DDMMYYYY')
Upvotes: 3