How do I get the difference between two datetimes in calendar hours (to adjust for daylight savings time).
This was suggested on a SO post: time_to_sec(timediff(to_date, from_date)).
But I get strange warnings:
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
Do I just ignore these warnings? Or is there a better way?
As stated in the docs, time_to_diff returns a TIME value and is limited to the range supported by the TIME field type: -838:59:59 -> 838:59:59. Your 984 hours is beyond the max supported value by ~150 hours.