Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL: DATE_ADD

Tags:

mysql

dateadd

Is there a difference between:

SELECT DATE_ADD('2005-01-01', INTERVAL 3 MONTH);

and

SELECT '2005-01-01' + INTERVAL 3 MONTH;
like image 918
John Kurlak Avatar asked Jul 15 '09 00:07

John Kurlak


People also ask

What is DATE_ADD in MySQL?

The DATE_ADD() function adds a time/date interval to a date and then returns the date.

How do I add 10 years to a date in MySQL?

DATE_ADD() function in MySQL is used to add a specified time or date interval to a specified date and then return the date. Specified date to be modified. Here the value is the date or time interval to add.

Does Datepart work in MySQL?

There is no DATEPART function in MySQL. Use MONTH(date_column) or EXTRACT(MONTH FROM date_column) instead.


1 Answers

No, they're the same.

like image 111
chaos Avatar answered Sep 27 '22 22:09

chaos