Adding Days To Dates In MySQL

By  on  

One of my customers recently asked me to increment the date field on an event in their database by 14 days because their upcoming event got delayed. I knew the SQL statement would be simple and after doing some quick research, I found the magical SQL:

UPDATE events SET date_starts = DATE_ADD(date_starts,INTERVAL 14 DAY) WHERE event_id = 3;

This works on DATE and DATETIME field types. Note that it's "14 DAY" and not "14 DAYS".

Recent Features

  • By
    An Interview with Eric Meyer

    Your early CSS books were instrumental in pushing my love for front end technologies. What was it about CSS that you fell in love with and drove you to write about it? At first blush, it was the simplicity of it as compared to the table-and-spacer...

  • By
    Chris Coyier’s Favorite CodePen Demos

    David asked me if I'd be up for a guest post picking out some of my favorite Pens from CodePen. A daunting task! There are so many! I managed to pick a few though that have blown me away over the past few months. If you...

Incredible Demos

  • By
    WebSocket and Socket.IO

    My favorite web technology is quickly becoming the WebSocket API. WebSocket provides a welcomed alternative to the AJAX technologies we've been making use of over the past few years. This new API provides a method to push messages from client to server efficiently...

  • By
    Create a Quick MooTools Slideshow with Preloading Images

    I've been creating a lot of slideshow posts lately. Why, you ask? Because they help me get chicks. A quick formula for you: The following code snippet will show you how to create a simple slideshow with MooTools; the script will also...


  1. Nice but I use the time() function, what is better ?

  2. @Catar: I don’t know which one is better, per say, but I know that this worked wonderfully!

  3. Felix

    it’s good!!!!…works fine and it’s usefull for me. tks!!

  4. Nice! Wouldn’t have occurred to me that MySQL had such a feature. Personally I prefer to do all my data arithmetic in seconds before handing the result over to an SQL query, but this is worth noting.

  5. Your blog is my Quick Bible in the Caos of Days

  6. red


    i’m new to sql and i’m using mysql workbench to generate data mart. i need help..i want to generate dates (e.g. 2005-01-01), day of week ( 1 to 7), day of month (1 to 31), day name and month name for the whole of year 2005. the primary key is the date_key which starts from 1 to 365 and i already upload the date key into my database. it just that i need to generate all the above attributes using update/set but i dont know what is the correct sql script to generate them automatically and accordingly. would appreciate if u could help me on this..thanks

  7. Saleem Tahir

    Ok- That is helpfull but I want something like

    ” In a form an event is being added and it is add date is set to system date (today) Now I want the Event Expiry date to be automatically added in the event Expiry Date column based on the user choice. i.e User is give the choice to select that the event will expire in Two weeks, four weeks or Six weeks from the date of Adding”

  8. oSCho

    Thanks! I’ve been banging my head on the wall with this and your solution worked perfectly!



  10. Ben

    Brilliant! You save my day, David!

  11. More exciting that it could be:
    UPDATE events SET date_starts = DATE_ADD(date_starts,INTERVAL amountofdays DAY) WHERE event_id = 3;

    amountofdays is the name of the column in the same table;
    thus date_starts could be calculated depending on special amountofdays meaning for each row.

  12. Nazmul

    if (nice && useful)

    Print “Nice & useful post for me!”


    print “Bad Post”

    After execution give me result :

    Nice & useful post for me! ;)

  13. Brian

    What if you wanted to add, say, 3 business days to a Thursday?

  14. james

    how can I add days?so that i can set the return days of borrowed books, this is a library system im making. pls help. thank you so much

  15. pduke

    …this was a life saver!!!!!
    thank you man!!

  16. how about adding month,is it MON or MONTH?

  17. Monika

    I want to add 30 Working Days to yesterdays date while Saturday and Sunday both are not working days.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!