Add a Month to a Given Date


I have a var called DueDate and I need to add 1 month to this date.
I am having such difficulty doing this.

Here is my code and I’m getting an error "Object doesn’t support this property or method.

Any help would be appreciated

<script language=“Javascript”>

var DueDate = new date(“4/21/2009”);
var NewDate;

var iDay = DueDate.getDay();
var iMonth = DueDate.getMonth() + 1;
var iYear = DueDate.getYear();

NewDate = iDay + “/” + iMonth + “/” + iYear;


There are just a couple of errors here. It’s “new Date”, not “new date”. Also, the getYear method is deprecated. You need to use getFullYear instead.

Finally, the string you’re providing Date() with is ambiguous, because it’s only in the USA that it’s MM/DD/YYYY, everywhere else it’s DD/MM/YYYY, so that’s not good (Date.parse needs to be able to parse it). Look at the top of the [URL=“”]documentation for Date and you should be able to figure out a more suitable way of providing the date.