The modify-date operation adjusts a given date according to a modification string and returns the result in ISO 8601 format (Y-m-d\TH:i:sP).
How it works
- Input – a valid date string (e.g. 2024-02-21 15:30:00).
- Modification string – defines the relative change to apply. Common examples:
- +1 day → adds one day
- -2 hours → subtracts two hours
- +1 month → adds one month
- next Monday → shifts to the next Monday
- Output – the modified date, returned in ISO 8601 format (e.g. 2024-02-22T15:30:00+00:00).
- If the input cannot be parsed as a valid date, the original value is returned unchanged.
You can also use data placeholders inside the modification string (e.g. {days}), which will be replaced by values from other fields.
Examples
Input | Modification | Output |
---|---|---|
2024-02-21 15:30:00 | +1 day | 2024-02-22T15:30:00+00:00 |
2024-02-21 | -2 months | 2023-12-21T00:00:00+00:00 |
2024-02-21 | next Monday | 2024-02-26T00:00:00+00:00 |
invalid date | +1 day | invalid date |
Usage in PalDock
Use modify-date when you need to:
- Shift dates relative to a given point (e.g. “+30 days” for expiry).
- Normalize all dates into ISO 8601 format before sending to APIs.
- Automate scheduling based on relative expressions (“next Monday”, “last day of this month”).
- Adjust imported dates into different time frames.
Best Practices
- Always use clear relative formats (+1 day, -2 months) for predictable results.
- Be careful with month modifications (+1 month, -1 month) as they depend on the number of days in the month.
- Ensure all outputs are in ISO 8601 to maximize compatibility across systems.
- Validate inputs before applying modification to avoid passing through unmodified invalid values.