如何在MySQL中减去天数 [英] How to Subtract Days in MySQL
本文介绍了如何在MySQL中减去天数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在MySQL中减去时间?例如,今天是3月16日;我想减去15天才能达到3月1日.有什么方法可以用来从当前日期减去15天?
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屋!
查看全文