Vt102
09-19-2011, 04:54 PM
Hello.. somewhat new to JS and trying to learn as much as a I can.
I've been trying to do a little tool that will calculate dates for me, but I can;t get it to work properly.
The tool is meant to take a date and loop it by 26 2 week intervals. but i can only get today's date to show up. Any suggestions on how to make this work?
<script language="JavaScript">
var date = new Date();
for(var index = 0; index < 26; index++) {
document.write((date.getMonth()+1) + " " + date.getDate() + " " + date.getFullYear() + "<br/>");
date = date + (1000 * 60 * 60 * 24 * 14);
}
</script>
I've been trying to do a little tool that will calculate dates for me, but I can;t get it to work properly.
The tool is meant to take a date and loop it by 26 2 week intervals. but i can only get today's date to show up. Any suggestions on how to make this work?
<script language="JavaScript">
var date = new Date();
for(var index = 0; index < 26; index++) {
document.write((date.getMonth()+1) + " " + date.getDate() + " " + date.getFullYear() + "<br/>");
date = date + (1000 * 60 * 60 * 24 * 14);
}
</script>