跳到主要内容

hours_diff

hours_diff

description

Syntax

INT hours_diff(DATETIME enddate, DATETIME startdate)

开始时间到结束时间相差几小时

example

mysql> select hours_diff('2020-12-25 22:00:00','2020-12-25 21:00:00');
+----------------------------------------------------------+
| hours_diff('2020-12-25 22:00:00', '2020-12-25 21:00:00') |
+----------------------------------------------------------+
| 1 |
+----------------------------------------------------------+

keywords

hours_diff