We're Moving!

The Vertica Forum is moving to a new OpenText Analytics Database (Vertica) Community.

Join us there to post discussion topics, learn about

product releases, share tips, access the blog, and much more.

Create My New Community Account Now


Date/Time Functions are working wrong — Vertica Forum

Date/Time Functions are working wrong

edited June 2019 in General Discussion

Vertica version 9.2

Date/Time Functions are working wrong.

When we provide column_name which contains many rows with "DateTime" (Column Sample: 2019-05-11 23:45:29), the hour value in output we receive is completely wrong when compare to actual hour from actual table (column_name)
For Example: Column Sample: 2019-05-11 23:45:29`
Query: --SELECT HOUR ( "column_name");--
Output: 12(Instead of 23. I got 12).
or
--SELECT TIMESTAMP_TRUNC("column_name",'HH'),"column_name",TRUNC("column_name") FROM Table_Name;--
or
-- SELECT TO_CHAR ("column_name", 'HH24:MI:SS') AS my_date FROM Table_Name; --But Hard-code is working correctly
For Example:
--SELECT HOUR (TIMESTAMP '2019-05-11 23:45:29');--
--SELECT HOUR ( '2019-05-11 23:45:29');--
I don't know y these functions are wrongly calculating. Can anyone Help me to solve this issue? :)

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file