把unix 时间戳 转化成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中日期类型转化成 时间戳

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;

http://zhouyundong0482.blog.163.com/blog/static/10351792008226112412328/

posted on 2011-06-14 09:36  appleying  阅读(993)  评论(0)    收藏  举报