Oracle date to unix timestamp
677729Mar 13 2010 — edited Mar 14 2010Hi..
1. What is the command to convert oracle date to unix timestamp ?
2. What is the command to convert unix timestamp to oracle date ?
This is my conversion query, but when i convert back to oracle date in different server the time become late 1 hour. Why this is happened ?... is there any problem on my sessiontimezone or dbtimezone configuration ?
create or replace FUNCTION oracle_to_unix
(
in_date IN DATE)
RETURN NUMBER
IS
BEGIN
RETURN (in_date -TO_DATE('19700101','yyyymmdd'))*86400 - TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone),1,3))*3600;
END;
Please help me ...
Thank you,
Baharin