add
adds the number of date units to a date
Date add(Date date,number inc,string mode, [boolean copy] );
| date | Date | a date object |
| inc | number | a positive or negative number of units to be added to a date |
| mode | string | the name of a unit: "day", "week", "month", "quarter", "year", "hour" or "minute" |
| copy | boolean | defines whether a copy of the date will be created |
Example
var date1 = new Date(2012,11,12); // the copy parameter is set to false, the date won't be copied // so the date passed as a 1st parameter will be modified var date2 = webix.Date.add(date1,2,"day"); console.log(date1); // -> Fri Dec 14 2012 00:00:00 GMT+0300 console.log(date2); // -> Fri Dec 14 2012 00:00:00 GMT+0300 var date1 = new Date(2012,11,12); // the copy parameter is set to true, the date will be copied // so the date passed as a 1st parameter won't be modified var date2 = webix.Date.add(date1,2,"day",true); console.log(date1); // -> Wed Dec 12 2012 00:00:00 GMT+0300 console.log(date2); // -> Fri Dec 14 2012 00:00:00 GMT+0300
Back to top Join Our Forum
We've retired comments here. Visit our forum for faster technical support, connect with other developers, and share your feedback there.