MySQL ADDDATE () function usage tutorial, mysqladddate

Source: Internet
Author: User

MySQL ADDDATE () function usage tutorial, mysqladddate

Copy codeThe Code is as follows: ADDDATE (date, INTERVAL expr unit), ADDDATE (expr, days)

When the second parameter is called in the interval format, ADDDATE () is the synonym of DATE_ADD. SUBDATE () is synonymous with DATE_SUB. For details about the unit parameters in the interval, see the description of DATE_ADD.

mysql> SELECT DATE_ADD('1998-01-02', INTERVAL 31 DAY);+---------------------------------------------------------+| DATE_ADD('1998-01-02', INTERVAL 31 DAY)         |+---------------------------------------------------------+| 1998-02-02                       |+---------------------------------------------------------+1 row in set (0.00 sec)mysql> SELECT ADDDATE('1998-01-02', INTERVAL 31 DAY);+---------------------------------------------------------+| ADDDATE('1998-01-02', INTERVAL 31 DAY)         |+---------------------------------------------------------+| 1998-02-02                       |+---------------------------------------------------------+1 row in set (0.00 sec)

When the second parameter is called, MySQL adds it as an integer number of days to expr.

mysql> SELECT ADDDATE('1998-01-02', 31);+---------------------------------------------------------+| DATE_ADD('1998-01-02', INTERVAL 31 DAY)         |+---------------------------------------------------------+| 1998-02-02                       |+---------------------------------------------------------+1 row in set (0.00 sec)


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.