hue manny
hue manny

Reputation: 247

How to add multiple intervals to Date_Add

I want to add 2 months and 2 years to the current date but for some reason i cannot get it to work.

 Select DATE_ADD(NOW(), INTERVAL 2 MONTH, INTERVAL 2 YEAR);

Upvotes: 7

Views: 6047

Answers (2)

Ozzy
Ozzy

Reputation: 143

You could also just use addition

SELECT NOW() + INTERVAL 2 YEAR + INTERVAL 2 MONTH

Upvotes: 13

Gordon Linoff
Gordon Linoff

Reputation: 1269443

Try using date_add() twice:

Select DATE_ADD(DATE_ADD(NOW(), INTERVAL 2 MONTH), INTERVAL 2 YEAR);

Or once:

Select DATE_ADD(NOW(), INTERVAL 14 MONTH);

Upvotes: 6

Related Questions