向时间戳配置单元添加分钟数

yxyvkwin  于 2021-06-27  发布在  Hive
关注(0)|答案(1)|浏览(284)

我正试图在一个时间间隔上加/减14分钟,但不断收到错误或空值
我在做什么

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;

它给我空的
我希望无论act\U dprt\U dtmz时间戳加上14分钟

uemypmqf

uemypmqf1#

希望能成功:-)

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  |
+-------------------------+----------------------+--+

相关问题