SQL DATE_ADD

The SQL DATE_ADD is a mySql function which is same as SQL ADDDATE(), it’s used to add time values (intervals) to a date value.

Note: In SQL Server, we could use SQL DATEADD() function.

SQL DATE_ADD Syntax

DATE_ADD(date-expression, INTERVAL expr type)

For the type, please refer to the SQL ADDDATE() function.

SQL DATE_ADD Examples

SELECT DATE_ADD('2010-08-12', INTERVAL 3 DAY) AS NewDate

Result: 2010-08-15

SELECT DATE_ADD('2010-08-12', INTERVAL '3-2' YEAR_MONTH) AS NewDate

Result: 2013-10-12

SELECT DATE_ADD('2011-09-14 2:44:36', INTERVAL '2:26' HOUR_MINUTE) AS NewDate

Result: 2011-09-14 05:10:36

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>