时间戳函数from_unixtime函数

时间戳转为时间:

from_unixtime( unixtime,format),其中unixtime必须为整型(bigint),d若时间为秒时是10位,时间为毫秒时为13位。format是字符型(string),为所要转换的日期

例:from_unixtime(cast(substr(dt,1,10)as bigint),"yyyy-MM-dd")as time

dt 原为string类型,使用substr函数取 dt 的前10位,再使用cast函数转换成bigint类型,最后转为日期,精准到日。

 

posted @ 2020-04-29 14:30  jiumi  阅读(5536)  评论(0编辑  收藏  举报