timestamp格式 转换成 yyyyMMdd字符串

select create_time,from_unixtime(unix_timestamp(create_time), 'yyyyMMdd')

timestamp格式 转换成秒

2024-11-29 15:58:53.798

UNIX_TIMESTAMP(group_data_t.create_time)

yyyyMMdd格式 月份间隔

-- 定义两个日期
SELECT 
    months_between(
        to_date(concat_ws('-', substr('20250214', 1, 4), substr('20250214', 5, 2), '01')), 
        to_date(concat_ws('-', substr('20241214', 1, 4), substr('20241214', 5, 2), '01'))
    ) AS month_diff;

毫秒时间戳转yyyyMMdd

from_unixtime(cast(cast(successtime as bigint)/1000 as bigint),'yyyyMMdd')='$day'

from_unixtime(cast(eid/1000 as bigint),'yyyy-MM-dd')

from_unixtime(cast(max(eid)/1000 as bigint),'yyyy-MM-dd HH:mm:ss')