仅在MYSQL DATEDIFF中显示小时

我已经忙了好几个小时了,但是我无法正常工作。

SQL

SELECT DATEDIFF(end_time, start_time) as `difference` FROM timeattendance WHERE timeattendance_id = '1484'

start_time = 2012-01-01 12:00:00

end_time = 2012-01-02 13:00:00

时差为25(小时)。但是我得到的输出是1(天)。

如何获得25小时的输出?

回答:

关于使用TIMESTAMPDIFF呢?

SELECT TIMESTAMPDIFF(HOUR, start_time, end_time) 

as `difference` FROM timeattendance WHERE timeattendance_id = '1484'

以上是 仅在MYSQL DATEDIFF中显示小时 的全部内容, 来源链接: utcz.com/qa/420532.html

回到顶部