MySQL-MySQL tutorial

Source: Internet
Author: User
Tags mysql tutorial
MySQL DATE_ADD application scenario

/* Increase the current time by 1 Ms */
SELECT DATE_ADD (NOW (), INTERVAL 1 MICROSECOND );


/* The current time is reduced by 1 Ms */
SELECT DATE_ADD (NOW (), INTERVAL-1 MICROSECOND );


/* Add 1 second to the current time */
SELECT DATE_ADD (NOW (), INTERVAL 1 SECOND );


/* Current Time minus 1 second */
SELECT DATE_ADD (NOW (), INTERVAL-1 SECOND );


/* Add 1 minute to the current time */
SELECT DATE_ADD (NOW (), INTERVAL 1 MINUTE );


/* The current time minus 1 minute */
SELECT DATE_ADD (NOW (), INTERVAL-1 MINUTE );


/* Add the current time to 1 hour */
SELECT DATE_ADD (NOW (), INTERVAL 1 HOUR );


/* Current Time minus 1 hour */
SELECT DATE_ADD (NOW (), INTERVAL-1 HOUR );


/* Add the current date to 1 day */
SELECT DATE_ADD (NOW (), INTERVAL 1 DAY );


/* The current date minus one day */
SELECT DATE_ADD (NOW (), INTERVAL-1 DAY );


/* Add the current date to July 15, January */
SELECT DATE_ADD (NOW (), INTERVAL 1 MONTH );


/* The current date minus January */
SELECT DATE_ADD (NOW (), INTERVAL-1 MONTH );


/* Add the current date to the first quarter */
SELECT DATE_ADD (NOW (), INTERVAL 1 QUARTER );


/* The current date minus one quarter */
SELECT DATE_ADD (NOW (), INTERVAL-1 QUARTER );


/* Add the current date to 1 year */
SELECT DATE_ADD (NOW (), INTERVAL 1 YEAR );


/* The current date minus one year */
SELECT DATE_ADD (NOW (), INTERVAL-1 YEAR );

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.