ADDTIME()返回24小时时间 [英] ADDTIME() return 24 hour time
本文介绍了ADDTIME()返回24小时时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SELECT ADDTIME(TIME('23:59:59'), TIME('02:00:00'));
当前返回: '25:59:59'
我希望它返回: '01:59:59'
This currently returns: '25:59:59'
I want it to return: '01:59:59'
我知道一个简单的问题,但是我无法找出如何告诉MySQL做到这一点,而不是在25小时后返回.有什么想法吗?
A simple question I know but I just can't find out how to tell MySQL to do this rather than returning at 25 hour time. Any ideas?
推荐答案
不确定这是否是最好的解决方案,但似乎可行:
Not sure if that's the best solution, but it seems to work :
SELECT TIME((ADDTIME(TIME('23:59:59'), TIME('02:00:00')))%(TIME('24:00:00')));
这篇关于ADDTIME()返回24小时时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文