我想比较两个DateTime并在SQL中找到分钟
示例:
1. Date 1= 10/22/2014 20:00:00.000
2. Date 2= 10/22/2014 23:00:00.000
然后我想要这样的输出: 180分钟
答案 0 :(得分:2)
your exmple
SELECT TIMEDIFF('2014-10-22 23:00:00.000','2014-10-22 20:00:00.000')
OR
SELECT TIMESTAMPDIFF(MINUTE, '2014-10-22 20:00:00', '2014-10-22 23:00:00')
答案 1 :(得分:-1)
使用TIMESTAMPDIFF功能:
试试这个:
SELECT TIMESTAMPDIFF(MINUTE, '2014-10-22 20:00:00', '2014-10-22 23:00:00');