Get Interval between two date value - Node.js Date

Node.js examples for Date:Date Calculation

Description

Get Interval between two date value

Demo Code

dateUtil.getInterval = function (date1, date2) {
    var difference = Date.UTC(date1.getYear(), date1.getMonth(), date1.getDate(), 0, 0, 0) - Date.UTC(date2.getYear(), date2.getMonth(), date2.getDate(), 0, 0, 0);
    var difdays = difference / (1000 * 60 * 60 * 24);
    return difdays;
};

Related Tutorials