Skip to content

Subtract From A Date

What it does: Subtracts time periods (days, weeks, months, years) from dates to calculate past dates and historical analysis.

Perfect for: Historical analysis • Data retention • Deadline tracking • Past date calculations

  • Subtract time periods - Remove days, weeks, months, or years from any date
  • Handle business days - Skip weekends and holidays in calculations
  • Multiple time units - Work with years, months, weeks, days, hours, minutes
  • Smart date handling - Properly handle month boundaries and leap years
Subtract From A Date calculation illustration
graph LR
    A[Start Date] --> B[Subtract Time Period]
    B --> C[Past Date]

    style A fill:#e1f5fe
    style B fill:#e8f5e8
    style C fill:#f3e5f5

Simple process: Start Date - Time Period = Past Date

Subtract 30 days

{"amount": 30, "unit": "days"}

Subtract 3 months

{"amount": 3, "unit": "months"}

Subtract 2 weeks (business days only)

{"amount": 10, "unit": "days", "business_days_only": true}

Subtract 1 year

{"amount": 1, "unit": "years"}

Calculate Data Retention Cutoff: Verify which data is older than 90 days and needs to be deleted.

Input:

  • Current Date: Jan 15, 2024
  • Subtract: 90 days

Result:

  • Cutoff Date: October 17, 2023 (Any data created before this date is older than 90 days).

Calculate project start date (excluding weekends):

Input:

  • Deadline: Friday, January 31, 2024
  • Subtract: 15 business days
  • Skip: Weekends and holidays

Result:

  • Start date: Monday, January 8, 2024 (skipped 6 weekend days)

Configuration:

{
"input_date": "2024-01-31",
"amount": 15,
"unit": "days",
"business_days_only": true,
"holidays": ["2024-01-15", "2024-01-29"]
}

Data cleanup - Calculate cutoff dates for data retention policies Historical analysis - Find dates in the past for trend analysis Project planning - Determine start dates based on known deadlines Compliance - Calculate dates for regulatory requirements

Basic subtraction:

{
"input_date": "2024-01-15T10:00:00Z",
"amount": 7,
"unit": "days"
}

Business days with holidays:

{
"input_date": "2024-01-31T17:00:00",
"amount": 10,
"unit": "days",
"business_days_only": true,
"holidays": ["2024-01-15", "2024-01-29"]
}

Multiple time units:

{
"input_date": "2024-06-15",
"amount": 6,
"unit": "months"
}
UnitDescriptionExample
yearsCalendar yearsSubtract 2 years
monthsCalendar monthsSubtract 6 months
weeks7-day periodsSubtract 4 weeks
daysCalendar daysSubtract 30 days
hoursHoursSubtract 24 hours
minutesMinutesSubtract 120 minutes
secondsSecondsSubtract 3600 seconds

Weekend exclusion:

  • Automatically skips Saturdays and Sundays
  • Configurable weekend days (default: Saturday=6, Sunday=0)

Holiday exclusion:

  • Skip specific holiday dates
  • Holidays must be in YYYY-MM-DD format

Combined exclusions:

  • Skip both weekends and holidays
  • Ensures accurate business day calculations

Wrong month calculations: Month subtractions can vary due to different month lengths (Mar 31 - 1 month = Feb 28/29) Business day issues: Make sure holidays are in YYYY-MM-DD format Timezone problems: Specify timezone if working across different time zones

Related nodes: Add To A DateGet Current DateFormat Date

Common workflows: Data RetentionHistorical AnalysisProject Planning

Learn more: Date Handling GuideBusiness Logic Workflows