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

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差_第1张图片

from Thupdi  Fei Joe

 

你可能感兴趣的:(hive)