Oh MyUtils

Date Calculator - Days Between Dates, Age & Business Days

Calculate date differences, add/subtract durations, count business days, and determine age. All processing happens in your browser — no data sent to any server.

Frequently Asked Questions

What is a Date Calculator?

A Date Calculator is a tool that performs various date-related calculations including finding the difference between two dates, adding or subtracting durations, counting business days, and calculating age. It's essential for project planning, deadline estimation, contract calculations, and age verification.

How do I calculate days between two dates?

Select the 'Date Difference' tab, enter your start and end dates, and the calculator instantly shows the difference in years, months, days, weeks, hours, minutes, and seconds. You can toggle 'Include end date' to include the last day in the count.

How are business days calculated?

Business days exclude weekends (Saturday and Sunday) by default. Use the 'Business Days' tab, enter your date range, and optionally include Saturdays as business days. The calculator counts each weekday in the range.

Does this handle leap years correctly?

Yes. The calculator uses JavaScript's native Date API which correctly handles leap years, including February 29. Adding 1 year to February 29 will result in February 28 (or February 29 if the target year is also a leap year).

Is my date data secure?

Yes. All calculations are performed 100% in your browser using JavaScript. No date data is ever sent to any server. You can verify this by checking the network tab in your browser's developer tools.

Code Examples

// Calculate days between two dates
const start = new Date('2024-01-01');
const end = new Date('2024-12-31');
const diffMs = end.getTime() - start.getTime();
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
console.log(`${diffDays} days`); // 365 days

// Add days to a date
const date = new Date('2024-03-15');
date.setDate(date.getDate() + 90);
console.log(date.toISOString().split('T')[0]); // 2024-06-13

// Calculate age
const birthday = new Date('1990-05-15');
const today = new Date();
let age = today.getFullYear() - birthday.getFullYear();
const m = today.getMonth() - birthday.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthday.getDate())) age--;
console.log(`Age: ${age}`);

Related Tools