How to get the difference between two timestamps in seconds
You could use the TIMEDIFF() and the TIME_TO_SEC() functions as follows: SELECT TIME_TO_SEC(TIMEDIFF(‘2010-08-20 12:01:00’, ‘2010-08-20 12:00:00’)) diff; +——+ | diff | +——+ | 60 | +——+ 1 row in set (0.00 sec) You could also use the UNIX_TIMESTAMP() function as @Amber suggested in an other answer: SELECT UNIX_TIMESTAMP(‘2010-08-20 12:01:00’) – UNIX_TIMESTAMP(‘2010-08-20 12:00:00’) diff; +——+ | … Read more