我试图在时间间隔上加/减 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/