How do I get UTC time in seconds in oracle sql

Timestamps can be confusing and difficult to work with in oracle. It
took me a little time to figure out but the following SQL will give
you
SELECT (CAST(SYS_EXTRACT_UTC(systimestamp) AS DATE) -
TO_DATE('19700101', 'YYYYMMDD')) * 86400 seconds , current_timestamp
FROM dual
the UTC time in seconds from the epoch, as a floating point number.
60 * 60 * 24 for 60 seconds * 60 minutes * 24 hours = 86400

Comments

Popular posts from this blog

Vim vi how to reload a file your editing