hive - 向时间戳 Hive 添加分钟数

标签 hive timestamp

我试图在时间间隔上加/减 14 分钟,但一直收到错误或 null

我在做

select f.act_arrv_dtmz, from_unixtime(unix_timestamp('f.ACT_ARRV_DTMZ')+840)

但我一直收到错误。我也在尝试使用 CAST

select act_dprt_dtmz, CAST(act_dprt_dtmz as timestamp) - cast(from_unixtime(unix_timestamp(act_dprt_dtmz)+840) as timestamp) from heart_beat_data_temp; 

当我将变量放在引号中时,这没有给出正确的时间

select act_dprt_dtmz, CAST(act_dprt_dtmz as timestamp) - cast(from_unixtime(unix_timestamp('act_dprt_dtmz')+840) as timestamp) from heart_beat_data_temp; 

它给我 null

我希望 act_dprt_dtmz 时间戳加 14 分钟

最佳答案

希望这有效:-)

select current_timestamp() as current_time,
        from_unixtime(unix_timestamp(current_timestamp())+840) as added_time;


+-------------------------+----------------------+--+
|      current_time       |      added_time      |
+-------------------------+----------------------+--+
| 2019-03-27 16:48:38.38  | 2019-03-27 17:02:38  |
+-------------------------+----------------------+--+


关于hive - 向时间戳 Hive 添加分钟数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55385763/

相关文章:

hadoop - HDFS 上的 lsof 命令

hadoop - 针对特定场景的 Hive 查询

php - 如何使用php在两个日期之间生成随机日期?

java - 使用 JAVA 在数据库中存储日期/时间信息?

python - 如何在 Python 中构建朴素贝叶斯模型时使用时间戳数据

javascript - 找出 JS 和 PHP 中时间戳的差异

hadoop - 在oozie中覆盖hadoop的mapreduce.fileoutputcommitter.marksuccessfuljobs

hadoop - 配置单元插入覆盖目录仅覆盖生成文件的直接路径而不是目录

sql - 将数据插入 Hive 中的分区表时出错

golang RFC2822转换