unix_to_oracle:create or replace function unix_to_oracle(in_number NUMBER) return date is begin
return(TO_DATE('19700101','yyyymmdd') + in_number/86400 +TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone),1,3))/24);
end unix_to_oracle;

oracle_to_unix: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 oracle_to_unix;

posted on 2011-06-29 11:15  appleying  阅读(430)  评论(1编辑  收藏  举报