Prima pagină > Articole > Computing > Varia > Unix timestamp to Oracle date conversion

Unix timestamp to Oracle date conversion

Joi 30 septembrie 2010, de Valentin Murariu

CREATE OR REPLACE function UnixTimestampToOracleDate (p_timestamp in int)
return date is
begin
  return to_date(to_char(from_tz(cast((to_date('01-JAN-1970') + p_timestamp / 86400) as timestamp),'Etc/GMT') at time zone 'Europe/Zurich','DD.MM.YYYY HH24:MI:SS'),'DD.MM.YYYY HH24:MI:SS');
end UnixTimestampToOracleDate;
/

Atenţie la time zone folosit, pentru mine "Europe/Zurich" este OK, dar pentru voi ? Lista corecta şi la zi este pe site-ul de suport Oracle.