Skip to content
πŸ› οΈToolsShed

Date Calculator

Add or subtract days, weeks, months, or years from any date.

About this tool

A date calculator is essential for anyone who needs to work with timelines, deadlines, or future planning. Whether you're calculating how many days until a project deadline, figuring out your baby's age in weeks, or determining when a contract expires, this tool quickly performs date arithmetic without manual counting or calendar flipping.

To use the date calculator, simply enter your starting date, select the time unit you want to add or subtract (days, weeks, months, or years), specify the quantity, and click calculate. The tool instantly shows you the resulting date and can also display the total number of days between the two dates, giving you both the specific date and the duration at a glance.

This tool is particularly useful for project managers tracking milestones, parents monitoring child development in weeks, people planning vacations or events, and professionals working with contract expiration dates or subscription renewals. It eliminates the mental math and calendar confusion, making date calculations simple and error-free.

Frequently Asked Questions

Code Implementation

from datetime import date, timedelta
from dateutil.relativedelta import relativedelta  # pip install python-dateutil

def add_to_date(start: date, years=0, months=0, weeks=0, days=0) -> date:
    """Add years, months, weeks, and days to a date."""
    result = start + relativedelta(years=years, months=months, weeks=weeks, days=days)
    return result

def subtract_from_date(start: date, years=0, months=0, weeks=0, days=0) -> date:
    """Subtract years, months, weeks, and days from a date."""
    result = start - relativedelta(years=years, months=months, weeks=weeks, days=days)
    return result

# Example
today = date.today()
print(f"Today: {today}")
print(f"Today + 3 months: {add_to_date(today, months=3)}")
print(f"Today + 1 year 2 weeks: {add_to_date(today, years=1, weeks=2)}")
print(f"Today - 6 months: {subtract_from_date(today, months=6)}")
print(f"Today + 100 days: {add_to_date(today, days=100)}")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.