Date_add application Scenarios in MySQL
/* Current time plus 1 milliseconds */
SELECT Date_add (now (), INTERVAL 1 microsecond);
/* Current time minus 1 milliseconds */
SELECT Date_add (now (), INTERVAL-1 microsecond);
/* Current time plus 1 seconds */
SELECT Date_add (now (), INTERVAL 1 SECOND);
/* Current time minus 1 seconds */
SELECT Date_add (now (), INTERVAL-1 SECOND);
/* Current time plus 1 points */
SELECT Date_add (now (), INTERVAL 1 MINUTE);
/* minus 1 minutes for current time */
SELECT Date_add (now (), INTERVAL-1 MINUTE);
/* Current time plus 1 hours */
SELECT Date_add (now (), INTERVAL 1 HOUR);
/* Current time minus 1 hours */
SELECT Date_add (now (), INTERVAL-1 HOUR);
/* Current date plus 1 days */
SELECT Date_add (now (), INTERVAL 1 day);
/* Current date minus 1 days */
SELECT Date_add (now (), INTERVAL-1 Day);
/* Current date plus January */
SELECT Date_add (now (), INTERVAL 1 MONTH);
/* Current date minus January */
SELECT Date_add (now (), INTERVAL-1 MONTH);
/* Current date plus 1 quarter */
SELECT Date_add (now (), INTERVAL 1 QUARTER);
/* Current date minus 1 quarter */
SELECT Date_add (now (), INTERVAL-1 QUARTER);
/* Current date plus 1 years */
SELECT Date_add (now (), INTERVAL 1);
/* Current date minus 1 years */
SELECT Date_add (now (), INTERVAL-1 year);
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Date_add application Scenarios in MySQL