Add Time
Adds or subtracts a specified duration from a date/time value. This node is essential for calculating future or past dates in automation workflows.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Time - The input date/time value to modify. Must be formatted according to the selected Layout.
- Duration - The amount to add or subtract. Use positive numbers to add, negative numbers to subtract.
Output
- Time Result - The resulting date/time after adding or subtracting the duration, formatted in the same layout as the input.
Options
-
Layout - The date/time format of both input and output. Options include:
- ANSIC -
Mon Jan 2 15:04:05 2006 - UnixDate -
Mon Jan 2 15:04:05 MST 2006 - RubyDate -
Mon Jan 02 15:04:05 -0700 2006 - RFC822 -
02 Jan 06 15:04 MST - RFC822Z -
02 Jan 06 15:04 -0700 - RFC850 -
Monday, 02-Jan-06 15:04:05 MST - RFC1123 -
Mon, 02 Jan 2006 15:04:05 MST - RFC1123Z -
Mon, 02 Jan 2006 15:04:05 -0700 - RFC3339 -
2006-01-02T15:04:05-07:00(default, ISO 8601) - RFC3339Nano -
2006-01-02T15:04:05.000000000-07:00 - Custom - Define a custom format
- ANSIC -
-
Duration Unit - The unit of time for the duration value. Options include:
- Milliseconds - For precise timing operations
- Seconds - For short duration calculations
- Minutes - For hourly scheduling
- Hours - For daily scheduling
- Days - For weekly/monthly operations (default)
- Weeks - For longer-term scheduling
- Year - For annual calculations (365 days)
How It Works
The Add Time node performs date/time arithmetic by:
- Parsing the input time according to the specified layout
- Converting the duration value to the appropriate time unit
- Adding (positive) or subtracting (negative) the duration
- Formatting the result in the same layout as the input
- Outputting the calculated date/time
Use Cases
Deadline Calculations
- Calculate due dates for tasks
- Set expiration dates for temporary resources
- Determine payment deadlines
Scheduling Operations
- Schedule tasks for future execution
- Calculate reminder times before events
- Determine maintenance windows
Date Range Generation
- Generate start and end dates for reports
- Calculate billing periods
- Determine valid date ranges
Expiry Management
- Set cache expiration times
- Calculate token validity periods
- Manage session timeouts
Examples
Example 1: Add 7 Days to Current Date
Time: 2024-03-15T10:00:00Z
Duration: 7
Duration Unit: Days
Layout: RFC3339
Output: 2024-03-22T10:00:00Z
Example 2: Subtract 30 Minutes
Time: 2024-03-15T14:30:00Z
Duration: -30
Duration Unit: Minutes
Layout: RFC3339
Output: 2024-03-15T14:00:00Z
Example 3: Add 2 Hours
Time: 2024-03-15T09:00:00Z
Duration: 2
Duration Unit: Hours
Layout: RFC3339
Output: 2024-03-15T11:00:00Z
Example 4: Calculate Next Year
Time: 2024-03-15T10:00:00Z
Duration: 1
Duration Unit: Year
Layout: RFC3339
Output: 2025-03-15T10:00:00Z
Example 5: Subtract 3 Weeks
Time: 2024-03-15T10:00:00Z
Duration: -3
Duration Unit: Weeks
Layout: RFC3339
Output: 2024-02-23T10:00:00Z
Example 6: Add Milliseconds for Precise Timing
Time: 2024-03-15T10:00:00.000000000Z
Duration: 500
Duration Unit: Milliseconds
Layout: RFC3339Nano
Output: 2024-03-15T10:00:00.500000000Z
Workflow Example
Calculate Payment Due Date (30 days from invoice)
- Use Now node to get current date
- Use Add Time node:
- Time: Output from Now node
- Duration: 30
- Duration Unit: Days
- Use result as payment due date in invoice
Send Reminder 2 Hours Before Meeting
- Get meeting time from calendar
- Use Add Time node:
- Time: Meeting time
- Duration: -2
- Duration Unit: Hours
- Schedule reminder at the calculated time
Tips for Effective Use
- Negative Values for Subtraction - Use negative duration values to subtract time instead of add
- Choose Appropriate Units - Use the largest unit possible (e.g., Days instead of Hours) for better readability
- Year Calculations - Year unit uses 365 days; for calendar-accurate year additions, use 365 or 366 days based on leap year
- Maintain Format Consistency - Input and output use the same format; use Format Time node to convert if needed
- Time Zone Awareness - The calculation preserves the timezone from the input time
- Leap Years - Day-based additions automatically handle leap years and month-end dates correctly
Common Errors and Solutions
Error: "failed to parse input time"
- Cause: The input time format doesn't match the selected Layout
- Solution: Ensure the input time is formatted according to the Layout option, or change the Layout to match your input
Error: "time is required"
- Cause: No time value provided in the Time input
- Solution: Provide a valid date/time string in the Time input field
Error: "duration is required"
- Cause: No duration value provided
- Solution: Enter a numeric duration value (can be positive or negative)
Error: Invalid date/time output
- Cause: Duration calculation resulted in an invalid date
- Solution: Check that your duration and unit combination produces a valid date (e.g., not February 30th)
Important Notes
- The node preserves the timezone information from the input time
- Duration calculations automatically handle:
- Month boundaries (e.g., adding 1 day to Jan 31 = Feb 1)
- Year boundaries (e.g., adding 1 day to Dec 31 = Jan 1 next year)
- Daylight saving time transitions (when applicable)
- The Year unit is approximate (365 days); it doesn't account for actual calendar years
- For precise calendar operations (e.g., same date next month), consider using multiple Add Time nodes
Related Nodes
- Now - Get current date/time to use as input
- Time Span - Calculate the difference between two dates
- Format Time - Convert between different time formats
- Split Date - Extract individual components from a date