The approach of using the Date.setDate() method appears to exploit a
loophole in the method definition.
I wonder if anyone is more familiar than I with this... I think setDate()
basically adds its argument in days to the "beginning of the month"
(actually, the 0th day), and if you add more days than are in the month it
just rolls over into the next month.
Question is, is that behavior according to the standard or is it just the
browser writers' laziness - not wanting to worry about how many days are
actually in a month?
Van Knowles
vknowles@s...
>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Add days to date</title>
<script LANGUAGE=3D"javascript">
<!--
var a;
function init() {
window.status =3D new Date();
var sTarget =3D document.body;
var sNow =3D new Date();
var iInDays =3D 12;
var sFutureDate =3D new Date();
sFutureDate.setDate(sFutureDate.getDate()+iInDays);
sTarget.innerHTML =3D '<pre>Today : '+sNow+'<br>In '=
+iInDays+' days: '+sFutureDate+'</pre>';
a =3D window.setTimeout('init()', 1000);
}
//-->
</script>
</head>
<body ONLOAD=3D"a =3D window.setTimeout('init()', 1000)">
</body>
</html>
Cheers,
Sten Hougaard
EDB Gruppen
Application developer/web-designer
ASPECT/4 e-novation
Bredskifte All=E9 15
DK-8210 =C5rhus V
Tlf. +xx xx xx xx xx
Fax +xx xx xx xx xx
Mobil +xx xx xx xx xx
E-mail: stg@e...