function DateAdd (interval,number,date) {/* * Feature: Enables VBScript DATEADD functionality.
* Parameter: interval, a string expression representing the time interval to add.
* Parameter: number, numeric expression, representing the amount of time interval to add.
* Parameter: Date, Time object.
* Return: A new Time object.
* var now = new Date ();
* var newdate = DateAdd ("D", 5,now);
*---------------DateAdd (interval,number,date)-----------------*/switch (interval) {
Case "Y": {date.setfullyear (Date.getfullyear () +number);
return date;
Break
Case "Q": {Date.setmonth (Date.getmonth () +number*3);
return date;
Break
Case "M": {Date.setmonth (Date.getmonth () +number);
return date;
Break
Case "W": { Date.setdate (Date.getdate () +number*7);
return date;
Break
Case "D": {Date.setdate (Date.getdate () +number);
return date;
Break
Case "H": {date.sethours (date.gethours () +number);
return date;
Break
Case "M": {date.setminutes (Date.getminutes () +number);
return date;
Break
Case "S": {date.setseconds (Date.getseconds () +number);
return date;
Break
} default: {Date.setdate (D.getdate () +number); return date;
Break
}} var now = new Date ();
Plus five days.
var newdate = DateAdd ("D", 5,now);
Alert (newdate.tolocaledatestring ())//plus two months.
Newdate = DateAdd ("M", 2,now);
Alert (newdate.tolocaledatestring ())//plus one year newdate = DateAdd ("y", 1,now); Alert (newdate.tolocaledatestring ())