//Calculate Date AdditionfunctionDateAdd (interval, number, date) {Switch(interval) { Case"Y": {date.setfullyear (Date.getfullyear ()+Number ); returndate; Break; } Case"Q": {date.setmonth (Date.getmonth ()+ Number * 3); returndate; Break; } Case"M": {date.setmonth (Date.getmonth ()+Number ); returndate; Break; } Case"W": {date.setdate (date.getdate ()+ Number * 7); returndate; Break; } Case"D": {date.setdate (date.getdate ()+Number ); returndate; Break; } Case"H": {date.sethours (date.gethours ()+Number ); returndate; Break; } Case"M": {date.setminutes (date.getminutes ()+Number ); returndate; Break; } Case"S": {date.setseconds (Date.getseconds ()+Number ); returndate; Break; } default: {date.setdate (d.getdate ()+Number ); returndate; Break; } }}
// converts the date of a string class to a date class var New Date (2017-09-14 00:00:00.000); // and then calculate var nextdate = DateAdd ("y", 3,date)
JS converts the string class to a date class and calculates