<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<meta http-equiv= "Content-type" content= "text/html; charset=windows-1250 ">
<meta name= "generator" content= "PSPad editor, www.pspad.com" >
<title></title>
<body>
<script type= "Text/javascript" >
Alert (Showdate (20));
function Showdate (calvalue) {
var dateobj = new Date ();
var curyear = Dateobj.getfullyear ();
var curmonth = dateobj.getmonth () + 1;
var curdate = Dateobj.getdate ();
Curmonth = curmonth > 9? Curmonth: "0" + curmonth;
Curdate = curdate > 9? Curdate: "0" + curdate;
var dateparameter = curyear + "/" + Curmonth + "/" + curdate;
var returndate = "";
Returndate = Calculatedate (Dateparameter, Calvalue);
return returndate;
}
function Calculatedate (Dateparameter, Calvalue) {
var calvalue = number (Calvalue);
var newdate = new Date (dateparameter);
Returns the millisecond value of a date
Newdate = Newdate.valueof ();
Millisecond value after plus/minus number of days
Newdate = newdate + calvalue * 24 * 60 * 60 * 1000;
Newdate = new Date (newdate);
If the month length is less than 2, the top plus 0 complements
var month = Newdate.getmonth () +1;
var month = month > 9? Month: "0" + month;
If the number of days is less than 2, the front plus 0 is the complement
var date = Newdate.getdate ();
var date = date > 9? Date: "0" + date;
var returndate = newdate.getfullyear () + "-" + month + "-" + date;
return returndate;
}
</script>
</body>
JS Count dates based on number of days