如何找到两个SQL时间戳值之间的差异,以分钟和秒为单位?
答案 0 :(得分:3)
尝试TIMEDIFF()函数:
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff
示例:
mysql> select timediff('2010-11-03 15:30:00','2010-11-03 14:00:00') as diff;
+----------+
| diff |
+----------+
| 01:30:00 |
+----------+
答案 1 :(得分:1)
使用TIMEDIFF:
SELECT TIMEDIFF(ts1, ts2) FROM ...