sqark unix_timestamp 时间戳转换的问题 - xd21303/Notebook GitHub Wiki
select
ctime,
unix_timestamp(ctime, 'YYYY-MM-dd HH:mm'),
cast(ctime as timestamp),
unix_timestamp(cast(ctime as timestamp))
from
tmp
limit 1
查询结果:
2021-08-02 10:40
1609036800
2021-08-02 10:40:00
1627872000
原始数据没有秒,直接用unix_timestamp转换时间戳,结果不正确。
需要先cast(ctime as timestamp),然后再转换时间戳就对了。