欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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 
  1. Convert both dates to seconds from 1970-01-01
  2. Substract them
  3. 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

hive 计算时间差精确到小时 stamp差

from Thupdi  Fei Joe

 

相关标签: hive