Posts: 65
Location: san francisco, ca
|
I have a working set of variables that gets & displays the current date, formats it, then populates a text field with it.
Using that date, i am adding X number of days, and displaying that new date in an LI elsewhere on the page.
The issue is that when i add, for example, 35 days to the current date (11/3/2010), i get an invalid date of (11/38/2010).
How do i get the number of days in any given month?
HERE IS MY HEAD CODE
Code:
var d = new Date();
var day = d.getDate();
var month = d.getMonth() +1;
var year = d.getFullYear();
var today = (month + "/" + day + "/" + year);
$("#datepicker").val(today);
var dueDate = (month + "/" + (d.getDate()+35) + "/" + year);
$("#duedatedisp").text(dueDate);
|