Skip to main content

hours_diff

hours_diff

description

Syntax:

INT hours_diff(DATETIME enddate, DATETIME startdate)

This function calculates the number of hours between the startdate and the enddate.

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