Rumah > Artikel > pangkalan data > 格林时间转换成正常时间
uscdbmt@rac1:~ date +%s 1414741902 oracle中怎么把这个1414741902转换成正常时间格式 select Numtodsinterval(1414741902-TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone), 1, 3)) * 3600, second)+to_date(1970-1-1, yyyy/mm/dd) from dual; select Numtods
uscdbmt@rac1:~> date +%s
1414741902
oracle中怎么把这个1414741902转换成正常时间格式
select Numtodsinterval(1414741902-TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone), 1, 3)) * 3600, 'second')+to_date('1970-1-1', 'yyyy/mm/dd') from dual;
select Numtodsinterval(1414741902-8*3600, 'second')+to_date('1970-1-1', 'yyyy/mm/dd') from dual;
当前时间转换成格林尼治时间:
select (to_number(to_date('2014/10/31 15:51:42','yyyy/mm/dd hh24:mi:ss') - to_date('19700101','yyyymmdd')) * 86400)-TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone), 1, 3))* 3600 from dual;