presto unixtimestamp转标准日期

匿名 (未验证) 提交于 2019-12-02 23:55:01

用到presto两个函数

1. from_unixtime

2.format_datetime

select '1566748800000', substr('1566748800000',1,10) as a, from_unixtime(cast(substr('1566748800000',1,10) as int)) as b, -- 13位毫秒级的unix timestamp截取到秒级别 format_datetime(from_unixtime(cast(substr('1566748800000',1,10) as int)),'yyyy-MM-dd')

 

转换结果

参考资料 https://prestodb.github.io/docs/current/functions/datetime.html

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!