I have an Epoch time value (e.g., 1686650137175) that I need to convert to a timestamp. When using to_timestamp() function, I encountered an error. How can I achieve this conversion?
Sereena Eldhose
Asked on Jul 06, 2023
SELECT TO_TIMESTAMP('1686650137.175');
This query accepts epoch time in seconds.
SELECT TO_TIMESTAMP(CAST(1688534502958 AS DECIMAL) / 1000);
This query first casts the value to decimal and then divides it by 1000 to convert milliseconds to seconds before converting to a timestamp.