How to calculate the time difference in Mysql?

Asked

Viewed 6,944 times

3

How to calculate, the difference of hours in the Mysql?

2 answers

4

To calculate the difference of hours in the Mysql use the Function TIMEDIFF which returns the difference between the hours, along with the Function CURTIME() that returns the current time.

Example:

SELECT TIMEDIFF(CURTIME(), hora) as dif 
               FROM conversas WHERE de=7 ORDER BY id DESC LIMIT 1;

References:

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.