SQL> create or replace function long2date (param in long) return varchar2 as v_text varchar2(64); 2 begin 3 select to_char(to_date('1970-01-01', 'YYYY-MM-DD')+(param/(24*60*60*1000)+ 8/24-1/86400),'YYYY-MM-DD HH24:MI:SS') 4 into v_text from dual; 5 return v_text; 6 end long2date; 7 /