I need to convert a time value stored as varchar into "time" data value. But when I do the conversion it added 19 hours to my original value. I need as result the same value but converted to time.
SELECT '00:51:09' AS ORIGINAL_TIME_VARCHAR,
TO_TIME('00:51:09') AS CONVERT_TO_TIME;
the result in the time conversion looks: 19:51:09
It's due to the time zone. Converting time zones is not a straight forward process with time data.
You can use this if you want a quick solution:
SELECT '00:51:09' AS ORIGINAL_TIME_VARCHAR,
TO_TIME('00:51:09') - INTERVAL '19 HOURS' AS CONVERT_TO_TIME;