如何在MySQL中减去时间 [英] How to Subtract Time in MySQL
本文介绍了如何在MySQL中减去时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
SELECT DATE(NOW() - INTERVAL 15 DAY)
有关单元列表,请参阅 http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html #function_date-add
How can I subtract time in MySQL? For example, today is 16 March; I want to subtract 15 days to reach 1 March. Are there any methods that can be used to subtract 15 days from the current date?
解决方案
SELECT DATE(NOW()-INTERVAL 15 DAY)
For a list of units see http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
这篇关于如何在MySQL中减去时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文