Reputation: 101
I need to parse a varchar column with the following format into a Hana timestamp:
02-JUN-17 09.10.51.633570 AM
I have tried this function:
SELECT to_timestamp('02-JUN-17 09.10.51.633570 AM','DD-MON-YY HH12.MI.SS.FF6') FROM dummy
Any ideas how to get this to work?
Could not execute 'SELECT to_timestamp('02-JUN-17 09.10.51.633570 AM','DD-MON-YY HH12.MI.SS.FF6') FROM dummy'
[303]: invalid DATE, TIME or TIMESTAMP value: Error while parsing '02-JUN-17 09.10.51.633570 AM' in format 'DD-MON-YY HH12.MI.SS.FF6' as DATE/TIME at function to_timestamp() (at pos 7)
Upvotes: 0
Views: 3556
Reputation: 10388
You forgot to include the AM/PM
placeholder in the format pattern string.
SELECT
to_timestamp('02-JUN-17 09.10.51.633570 AM',
'DD-MON-YY HH12.MI.SS.FF6 AM')
FROM dummy;
works just fine.
Upvotes: 2