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
What It Does
Section titled “What It Does”- 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
How It Works
Section titled “How It Works”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
Common Time Subtractions
Section titled “Common Time Subtractions”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"}Real Examples
Section titled “Real Examples”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).
Business Day Example
Section titled “Business Day Example”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"]}Common Use Cases
Section titled “Common Use Cases”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
Configuration Examples
Section titled “Configuration Examples”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"}Time Unit Options
Section titled “Time Unit Options”| Unit | Description | Example |
|---|---|---|
years | Calendar years | Subtract 2 years |
months | Calendar months | Subtract 6 months |
weeks | 7-day periods | Subtract 4 weeks |
days | Calendar days | Subtract 30 days |
hours | Hours | Subtract 24 hours |
minutes | Minutes | Subtract 120 minutes |
seconds | Seconds | Subtract 3600 seconds |
Business Day Features
Section titled “Business Day Features”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
Quick Troubleshooting
Section titled “Quick Troubleshooting”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
What’s Next?
Section titled “What’s Next?”Related nodes: Add To A Date • Get Current Date • Format Date
Common workflows: Data Retention • Historical Analysis • Project Planning
Learn more: Date Handling Guide • Business Logic Workflows