Monday, February 20, 2012

MySQL Adding Dates

Talk about way easy to add to a date using MySQL. Didn't know it would be this simple:



Let's say you want to add a certain number of years to a date:




DATE_ADD(NOW(), INTERVAL 1 YEAR)


Now, wasn't that easy?



You can do the same thing for days as well. Just change INTERVAL 1 YEAR to INTERVAL 1 DAY



Yep, that's pretty much it.



Happy coding!

No comments:

Post a Comment

Ever feel like no one is listening?

 Ever have that feeling that no one is listening to you? Yeah, that feeling. It can be a strong feeling to have, a hurtful feeling also. The...