MySQL time add function date_add ()

Source: Internet
Author: User
Tags time interval

The Date_add () function in MySQL

1. Definition: The function adds the specified time interval to the date.

2. Syntax: Date_add (date,interval expr type)

The date parameter is a valid day expression. The expr parameter is the time interval that you want to add.

The type parameter can be the following value:

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

3. Example:

Select Now ();

#2018-08-13 22:44:28

Select Date_add (now (), INTERVAL 2 day);

#2018-08-15 22:44:28

MySQL time add function date_add ()

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.