0
如何在日历小时内获取两个日期时间之间的差异(以调整夏令时)。如何在日历小时内获取日期时间差异
这是SO贴子上建议的:time_to_sec(timediff(to_date, from_date))
。
但是我得到了奇怪的警告:
select time_to_sec("65:00:00");
show warnings; -- nonthing
select time_to_sec("984:00:00");
show warnings; -- Truncated incorrect time value: '984:00:00
难道我只是忽略这些警告?或者,还有更好的方法?
那么,有没有另一种方法来获得两个日期时间之间的差异几小时? – Bradford
使用unix时间戳和一些视角,例如'(unix_timestamp(time1) - unix_timestamp(time2))/(60 * 60)'。 unix时间戳只是整数,表示从1/70开始的秒数。 –