Reputation: 191
how to convert a varchar value like 19-JAN-18 06.53.31.000000 AM
to timestamp? thx
Upvotes: 0
Views: 1046
Reputation: 1270793
You can use to_timestamp()
. Something like this:
select to_timestamp('19-JAN-18 06.53.31.000000 AM', 'DD-MON-YY HH24.MI.SS.FF6 AM')
This uses Oracle's format model. I'm not sure if Teradata's is exactly the same.
Upvotes: 1
Reputation: 37483
You can try this
sel cast(cast(cast('19-JAN-18 06.53.31.000000 AM' as varchar(50)) as timestamp(0) format 'mm/dd/yyyyBhh:mi:ss') as timestamp(0));
Upvotes: 0