select to_char('1436346362189', 'yyyy-MM-dd hh:mm:ss') from dual;
自己验证一下可以吗?????
create table test111(
id integer,
modifydatetime timestamp);
insert into test111 values(1, sysdate);
select to_char(modifydatetime, 'yyyy-MM-dd hh:mm:ss') from test111;
结果是
25-11月-15 04.33.05.000000 下午
直接执行select to_char('1436346362189', 'yyyy-MM-dd hh:mm:ss') from dual;应该会出错吧。
'1436346362189'这本身就是一个字符串了。
对,本身就是一字符串,数据库存的就是时间戳转的字符串,由于我的问题描述的不够详细,这里补充一下,那个时间是字符串类型是VACHAR(50) ,java代码 System.currentTimeMillis() 获取时间戳,然后转成的字符串存储的
追答select to_date('1970-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss') + 1436346362189/(24*60*60*1000) from dual;
本回答被提问者和网友采纳