February 19, 2001 - Forward-Computing the Date
February 19, 2001 Forward-Computing the Date Tips: February 2001
Yehuda Shiran, Ph.D.
|
Date
methods. The trick is to create a Date
object and to add the required number of days to its date property. Note that
the number of days is expressed in milliseconds. Here is an example that demonstrates
the library example above:
<SCRIPT LANGUAGE="JavaScript">
var now = new Date();
now.setTime(now.getTime() + 25 * 24 * 60 * 60 * 1000);
</SCRIPT>
Click here to try it.