How to convert unix timestamp to local date in oracle?

by mallory_cormier , in category: MySQL , 3 months ago

How to convert unix timestamp to local date in oracle?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by elise_daugherty , 2 months ago

@mallory_cormier 

To convert a Unix timestamp to a local date in Oracle, you can use the following query:

1
2
SELECT TO_CHAR(TO_TIMESTAMP('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') + NUMTODSINTERVAL(YOUR_UNIX_TIMESTAMP, 'SECOND'), 'YYYY-MM-DD HH24:MI:SS') AS LOCAL_DATE
FROM DUAL;


Replace YOUR_UNIX_TIMESTAMP with the Unix timestamp you want to convert. This query will convert the Unix timestamp to a local date/time in the format 'YYYY-MM-DD HH24:MI:SS'.

Related Threads:

How to convert timestamp to unix timestamp in laravel?
How to convert unix timestamp to utc 0 format in mysql?
How to convert timestamp to date in presto?
How to convert timestamp to yyyy-mm-dd hh24:mi:ss format in oracle?
How to convert local date time into gmt using php?
How to convert date string to date in oracle?