hive 计算时间差精确到小时 stamp差
程序员文章站
2022-06-21 17:45:31
...
You could use unix_timestamp
for dates after 1970
:
SELECT
(unix_timestamp('2013-01-01 10:10:10') - unix_timestamp('1970-01-01 00:00:00'))/60
- Convert both dates to seconds from
1970-01-01
- Substract them
- Divide by 60 to get minutes
for example: if your start_time is 2017-09-14 23:35:53 and end_time is 2017-09-14 23:35:53
you can use (unix_timestamp(
end_time)-unix_timestamp(
start_time))/60 the result is stamp diff
from Thupdi Fei Joe
上一篇: 乐优商城项目实战(十五)购物车