节点 / builtin / datatransformation / datetime
Subtract From A Date
Subtract a number of days from a date
此内容尚不支持你的语言。
Move a date back by a number of years, months, days, hours or other units.
What it does
Section titled “What it does”Subtract From A Date takes Date to subtract from, removes Duration of the chosen Time unit to subtract, and writes the new date into a field named by Output field name.
- Units: year, quarter (3 months), month, week (7 days), day, hour, minute, second.
- The calculation uses your computer’s local time zone.
- Going back a month from the 31st rolls over when the earlier month is shorter: 31 March minus 1 month gives 3 March (or 2 March in a leap year), not 28 February.
When to use it
Section titled “When to use it”- Build the start of a “last 7 days” or “last 24 hours” window.
- Work out when a reminder should fire before a deadline.
- Find a date one year ago for a comparison.
Inputs and settings
Section titled “Inputs and settings”| 设置项 | 类型 | 作用 |
|---|---|---|
| Date to subtract from (必填) | Date and time | The date to subtract days from. |
| Time unit to subtract (必填) | Choice | The time unit to subtract from the date. Options: year, quarter, month, week, day, hour, minute, second. |
| Duration (必填) | Number | The duration to subtract from the date. |
| Output field name (必填) | Text | The name of the output field. |
| Options | Group | The options for the node. |
| Options › Include input fields | Toggle | Whether to include the input fields in the output. 默认值:Off |
Date to subtract from accepts a picked date or an expression such as {{ $input.deadline }}. ISO dates (2026-03-01, 2026-03-01T09:30:00Z) are the safest format.
Outputs
Section titled “Outputs”-
Output
The item holds the new date under Output field name. Turn on Include input fields to keep the incoming fields next to it.
Dependencies and credentials
Section titled “Dependencies and credentials”None. This node needs no connection and has no slots for other nodes.
Example workflow
Section titled “Example workflow”Keep only feed items from the last 24 hours:
- RSS Feed Read, URL of a news feed.
- Split Out, Field To Split Out
items, Output field namearticle, so each article becomes its own item. - Get Current Date, Output field name
now, Include input fields on. - Subtract From A Date, Date to subtract from
{{ $input.now }}, Time unit to subtractday, Duration1, Output field namesince, Include input fields on. - Filter:
{{ $input.article.isoDate }}is after{{ $input.since }}, type Date-Time.
Common issues
Section titled “Common issues”- The output is “Invalid Date” or empty. The incoming value is not a date the browser understands. Use an ISO date such as
2026-03-01. - The month result lands in the wrong month. Subtracting months from the 29th to the 31st can roll forward into the next month. Round the date down to
monthfirst with Round a Date when you only care about the month. - The new date is missing after the node. With Include input fields on, an incoming field with the same name as Output field name replaces the result. Use a different name.
Related nodes
Section titled “Related nodes”- Add To A Date: move a date forward.
- Round a Date: snap to the start of a day or month.
- Get Current Date: start from “now”.
- Filter: keep items newer than the computed date.