当前位置: 代码迷 >> 综合 >> presto时间戳转换错误 Expected: to_unixtime(timestamp) , to_unixtime(timestamp with time zone)
  详细解决方案

presto时间戳转换错误 Expected: to_unixtime(timestamp) , to_unixtime(timestamp with time zone)

热度:74   发布时间:2023-12-17 21:12:49.0

Expected: to_unixtime(timestamp) , to_unixtime(timestamp with time zone)

(cast('2019-09-09 12:32:05' as timestamp)-cast('2019-09-08 12:32:05' as timestamp)

减出来是              1 xx:xx:xx as s

执行方法 to_unixtime(s)

出错

 

解决方法:

to_unixtime((cast('2019-09-09 12:32:05' as timestamp))-to_unixtime(cast('2019-09-08 12:32:05' as timestamp))

转换成毫秒后就可以想变成啥变成啥。时分秒 任你选。怎么变时分秒,presto没有响应的方法, 你可以自己写prest function自定义函数,也可以写/60变成分,具体请查看 进制 之间的关系

  相关解决方案