You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Richard Scott (Jira)" <ji...@apache.org> on 2026/03/03 18:38:00 UTC
[jira] [Updated] (NIFI-15658) Add plusDuration and minusDuration functions to NiFi Expression Language for date arithmetic
[ https://issues.apache.org/jira/browse/NIFI-15658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard Scott updated NIFI-15658:
---------------------------------
Summary: Add plusDuration and minusDuration functions to NiFi Expression Language for date arithmetic (was: Add datePlus and dateMinus functions to NiFi Expression Language for date arithmetic)
> Add plusDuration and minusDuration functions to NiFi Expression Language for date arithmetic
> --------------------------------------------------------------------------------------------
>
> Key: NIFI-15658
> URL: https://issues.apache.org/jira/browse/NIFI-15658
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Core Framework, Extensions
> Affects Versions: 2.8.0
> Reporter: Richard Scott
> Assignee: Richard Scott
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> NiFi Expression Language provides {{toDate()}} for parsing values into a {{{}Date{}}}, but there is no simple built-in way to then add or subtract time from that {{{}Date{}}}.
> Currently, users wanting to shift a parsed date must often convert the {{Date}} back to a numeric value, perform arithmetic in milliseconds, and then convert or format the result again. This is awkward and makes common date operations harder to read and maintain.
> For example, users should be able to write:
>
> ${myDate:toDate("dd-MM-yyyy"):datePlus("1 week"):format("dd-MM-yyyy")}
>
> instead of relying on number-based date arithmetic after parsing.
> Proposed new functions:
> * {{datePlus(String duration)}}
> * {{dateMinus(String duration)}}
> Supported units:
> * years
> * months
> * weeks
> * days
> * hours
> * minutes
> * seconds
> The duration argument should be validated strictly, for example:
> * valid: {{{}"1 day"{}}}, {{{}"2 weeks"{}}}, {{"3 months"}}
> * invalid: {{{}"B weeks"{}}}, {{{}"1 dog"{}}}, {{"ten days"}}
> Both functions should operate on and return {{Date}} values so they can be chained naturally with existing date-related Expression Language functions such as {{{}format(){}}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)