Syntax of the SQL Dateadd Function
For the rest of this article we are going to use the SQL dateadd function from MySQL. The syntax of this function comes in the format as shown below.
DATE_ADD(date,INTERVAL expression type)
MySQL also provides an alternative which happens to be a synonym for DATE_ADD(). The syntax for the synonym is as follows.
ADDDATE(date, INTERVAL expression type)
In both cases above the date can be a simple date format in the form of text or it can be a date and time value. The INTERVAL represents an integer that represents a number of the expression types. So if you plan to add a single day to the date my INTERVAL would be “1" and expression type would be DAY. Other expression types supported by MySQL are as follows.
DAY_HOUR "DAYS HOURS"
DAY_MINUTE "DAYS HOURS:MINUTES"
DAY_SECOND "DAYS HOURS:MINUTES:SECONDS"
The Items in quotes represent the entries you can use as the INTERVAL.