3raser Posted November 5, 2012 Share Posted November 5, 2012 I have several units (days, weeks, years) I'd like to add to the current date in MySQL. How would I go about doing this? I tried: ADDDATE(CURRENT_DATE(), INTERVAL {$length[0]} YEAR INTERVAL {$length[1]} MONTH INTERVAL {$length[2]} WEEK INTERVAL {$length[3]} DAY) But doesn't work. Can you even add multiple intervals? Quote Link to comment Share on other sites More sharing options...
Barand Posted November 5, 2012 Share Posted November 5, 2012 mysql> SELECT CURDATE() + INTERVAL 1 YEAR + INTERVAL 1 MONTH + INTERVAL 1 DAY as newdate; +------------+ | newdate | +------------+ | 2013-12-06 | +------------+ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.