1. 程式人生 > >hive 計算時間差精確到小時 stamp差

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  (uend_timestart_time))/60 the result is stamp diff

from Thupdi  Fei Joe