Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * subtractDateFromDate
- * Use the millisecond value insert both elements to calculate a new date.
- * @param d1 {Date}
- * @param d2 {Date}
- */
- function subtractDateFromDate(d1, d2) {
- return new Date(d1.getTime() - d2.getTime());
- }
- /**
- * addDaysToDate
- * Create a new Date based on the milliseconds of the first date,
- * adding the milliseconds for the extra days specified.
- * Notice that days can be a negative number.
- * @param d {Date}
- * @param days {number}
- */
- function addDaysToDate(d, days) {
- var oneDayInMilliseconds = 86400000;
- return new Date(d.getTime() + (oneDayInMilliseconds * days));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement