栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

flinksql下的时间格式转换

flinksql下的时间格式转换

flinksql里面最常用的事情就是时间格式转换,比如各种时间格式转换成TIMESTAMP(3).
now() bigint-- CAST(TO_TIMESTAMP(log_time) as TIMESTAMP(3)) ,log_time=now()
localtimestamp timestamp(3)

timestamp – 不带括号数字表示timestamp(6)
now() 1403006911000 bigint – 毫秒时间戳数值
localtimestamp 1636272032500 timestamp(3) – 毫秒时间戳
timestamp(3) 1636272032500 – 毫秒时间戳
timestamp(9)
timestamp(6)

TIMESTAMP(9) TO_TIMESTAMP(BIGINT time)
TIMESTAMP(9) TO_TIMESTAMP(STRING time)
TIMESTAMP(9) TO_TIMESTAMP(STRING time, STRING format)
BIGINT TIMESTAMP_TO_MS(TIMTSTAMP time)
BIGINT TIMESTAMP_TO_MS(STRING time, STRING format)

TO_DATE(CAST(LOCALTIMESTAMP AS VARCHAR))

FROM_UNIXTIME(TIMESTAMP_TO_MS(localtimestamp)/1000, ‘yyyy-MM-dd HH:mm:ss’)

参考文档:
https://ci.apache.org/projects/flink/flink-docs-master/zh/docs/dev/table/concepts/timezone/

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/439143.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号