首页 > 其他 > 详细

presto unixtimestamp转标准日期

时间:2019-08-27 14:07:35      阅读:580      评论:0      收藏:0      [点我收藏+]

用到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

 

presto unixtimestamp转标准日期

原文:https://www.cnblogs.com/MrZhangL/p/11417960.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!