How to Add Days to a Date in JavaScript

By Kevin Lee

JavaScript date manipulation is not as robust and full-featured as the date-handling methods found in higher level programming languages such as PHP and ASP.NET. If you need to format a date in JavaScript or perform date arithmetic, you must manually manipulate objects and use various built-in functions. Developers frequently add Web pages to their websites that require date addition. Add days to dates on your site by creating a generic JavaScript date handler.

Step 1

Open one of your Web pages in Notepad or in an HTML editor.

Step 2

Add the following JavaScript function to the