MySql教程

mysql- 日期函数 date_sub()和date_add

本文主要是介绍mysql- 日期函数 date_sub()和date_add,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

DATE_ADD(date,INTERVAL expr unit)DATE_SUB(date,INTERVAL expr unit)

These functions perform date arithmetic. The date argument specifies the starting date or datetime value. expr is an expression specifying the interval value to be added or subtracted from the starting date. expr is evaluated as a string; it may start with a - for negative intervals. unit is a keyword indicating the units in which the expression should be interpreted.

例:

这篇关于mysql- 日期函数 date_sub()和date_add的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!