Start Date
End Date
Calendar Days Since Calculator
Formula to calculate days between two dates.
To calculate days from date, first find the time difference between the 2 dates - start and end date
You can use the inbuilt funtion like getTime()
time diff = Math.abs(d2Date.getTime() - d1Date.getTime());
Convert the time format to days format
No of Days = timeDiff / (1000 * 3600 * 24);
Years between two dates
years = Math.floor(number of days / 365);
Months between two dates
months = Math.floor(number of days / 30);
Weeks between two dates
weeks = Math.floor(number of days / 7);
Calculate Time between two dates
hours = number of days * 24;
minutes = number of days * 24 * 60;
seconds = number of days * 24 * 60 * 60;
Business Days Since Calculator / Working Days Calculator
How to find the working day / business days between 2 dates
To count days between dates, first get the time in millisecs from both dates
Calculate days between start and end dates using getTime() and convert times to days
millisecondsPerDay = 86400 * 1000;
startDate.setHours(0, 0, 0, 1);
endDate.setHours(23, 59, 59, 999);
time diff = endDate.getTime() - startDate.getTime();
no of days = Math.ceil(time diff / millisecondsPerDay);
Subtract two weekend days for every week in between
weeks = Math.floor(days / 7);
days = days - (weeks * 2);
Remove weekend not previously removed.
if (startDay - endDay > 1)
days = days - 2;
Remove start day if span starts on Sunday(0) but ends before Saturday(6)
if (startDay == 0 && endDay != 6)
days = days - 1
Remove end day if span ends on Saturday(6) but starts after Sunday(0)
if (endDay == 6 && startDay != 0)
days = days - 1