首页 > 解决方案 > 在 Hive 3.1.3 中将时间戳从 ms 转换为字符串格式

问题描述

我正在尝试将毫秒时间戳转换为字符串格式,同时保留 ms 部分。下面的代码:

选择 from_unixtime(cast(unix_timestamp(current_timestamp) + regexp_extract(string(current_timestamp),'\.(\d+)$',1) as int), "yyyy-MM-dd HH:mm:ss.SSS") 作为 date_formatted_ms

但是我没有以良好的格式获得 ms 部分:在此处输入图像描述

我怎样才能解决这个问题?

谢谢

标签: hivehiveql

解决方案


推荐阅读