How to convert unix timestamp to local date in oracle?

by mallory_cormier , in category: MySQL , a month ago

How to convert unix timestamp to local date in oracle?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by elise_daugherty , a month 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'.