Page 1 of 1

TO_DATE('0730', 'hh24mi') in Vertica

Posted: Mon Dec 14, 2015 4:24 pm
by ksreekanth
Hi Experts,

I need help in converting the below query into Vertica.

The below is the output I get when the query is run in Oracle.

SELECT TO_CHAR(TO_DATE('0730', 'hh24mi'),'HH24:MI') AS TIME1 FROM DUAL
--07:30

I wanted to get the same result in Vertica. Could you please help me on this?

Regards,
Sreekanth

Re: TO_DATE('0730', 'hh24mi') in Vertica

Posted: Mon Dec 14, 2015 10:22 pm
by JimKnicely
Use TO_TIMESTAMP instead of TO_DATE:

Code: Select all

dbadmin=> SELECT TO_CHAR(TO_TIMESTAMP('0730', 'HH24MI'), 'HH24:MI') TIME1;
 TIME1
-------
 07:30
(1 row)

Re: TO_DATE('0730', 'hh24mi') in Vertica

Posted: Tue Dec 15, 2015 1:19 pm
by ksreekanth
Thank you very much..it really worked well 8-)