Hi,
I’m getting a little lost here. I need to add 18 months to a date entered on a form and show the results to the user without the time. so a date like 1/1/2000 is entered and the results should be 06/30/2001. I am parsing the string and adding 18 months of milliseconds to the date. While I have gotten this to work, it is not correct because each month has a different # of days.
Can anyone show me an easier way to add 18 months to a date entered by a user?
Thanks.
[CODE]
var str = document.form1.startdate.value;
var d1 = Date.parse(document.form1.startdate.value);
var d7 = d1+86400000*30*18;
var lm = new Date(d7);
var dt = lm.getDate();
var mm = lm.getMonth()+1;
var yy = lm.getFullYear();
var lmDate = mm + “-” + dt + “-” + yy;
document.getElementById(‘results1’).innerHTML = lmDate;