I'm still learning SQL and I found a couple of solutions on SQL Server or Postgreы, but it doesn't seen to work on HUE
DATEDIFF
, only allows me to calculate difference between days
seconds, minutes are not available. Help is very welcome.
I was able to split the timestamp with substring_index
, but then I can't find the right approach to compare and subtract start_time to end_time in order to obtain the accurate account of seconds. I can't find time functions so I'm assuming I should calculate it based on timestamp. obtained as
from_unixtime(unix_timestamp(start_time, "yyyy-MM-dd'T'HH:mm:ss.SSSSSS"), 'yyyy-MM-dd HH:mm:ss')
substring_index(start_time, 'T', -1)s_tm,
substring_index(end_time, 'T', -1)e_tm
start_date 2018-06-19 13:59:41
end_date 2018-06-19 14:01:17
desired output
01:36
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…