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

Moderator: NorbertKrupa

Post Reply
ksreekanth
Newbie
Newbie
Posts: 3
Joined: Tue Nov 24, 2015 2:57 pm

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

Post by ksreekanth » Mon Dec 14, 2015 4:24 pm

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

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

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

Post by JimKnicely » Mon Dec 14, 2015 10:22 pm

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)
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

ksreekanth
Newbie
Newbie
Posts: 3
Joined: Tue Nov 24, 2015 2:57 pm

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

Post by ksreekanth » Tue Dec 15, 2015 1:19 pm

Thank you very much..it really worked well 8-)

Post Reply

Return to “Vertica SQL Functions”