📅

Date Calculator

Verified

by Community

Compute the number of days between dates, add or subtract time periods, find the day of the week, and calculate business days.

datecalendarcalculatorutilities

Date Calculator Skill

Calculate dates using Python.

Days Between Dates

python3 -c "
from datetime import date
d1 = date(2024, 1, 1)
d2 = date(2024, 12, 31)
print(f'{abs((d2 - d1).days)} days')"

Add/Subtract Days

python3 -c "
from datetime import date, timedelta
d = date.today()
result = d + timedelta(days=30)
print(f'{d} + 30 days = {result} ({result.strftime(\"%A\")})')
"

Business Days

python3 -c "
from datetime import date, timedelta
start = date(2024, 1, 1)
end = date(2024, 1, 31)
bdays = sum(1 for i in range((end-start).days+1) if (start+timedelta(i)).weekday() < 5)
print(f'{bdays} business days')"