Home > Database > Mysql Tutorial > body text

MySQL DATE_ADD()函数_MySQL

WBOY
Release: 2016-06-01 13:34:25
Original
1189 people have browsed it

bitsCN.com

MySQL DATE_ADD()函数

 

其实我一直觉得叫DATE_ADD()函数不合理,老误导别人,因为不仅仅是日期的增加,其实我很多时候是用他来减法的。是不是改成DATE_CHANGE()更好?:)

 

定义和用法

DATE_ADD() 函数向日期添加指定的时间间隔。

用法:

 

[sql] 

DATE_ADD(date,INTERVAL expr type)  

date 参数是合法的日期表达式。expr 参数是您希望添加的时间间隔。 type表示类型。

type 参数可以是下列值:

 

Type 值

MICROSECOND

SECOND

MINUTE

HOUR

DAY

WEEK

MONTH

QUARTER

YEAR

SECOND_MICROSECOND

MINUTE_MICROSECOND

MINUTE_SECOND

HOUR_MICROSECOND

HOUR_SECOND

HOUR_MINUTE

DAY_MICROSECOND

DAY_SECOND

DAY_MINUTE

DAY_HOUR

YEAR_MONTH

如:

 

[sql] 

DATE_ADD(#BIZ_DATE#,INTERVAL -1 DAY)  

 

这里表示#BIZ_DATE#减去一天

 

bitsCN.com
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template