Could somebody tell me how I can add x number of days to a date attribute that is in the format ("yyyy-MM-dd") in Nifi.
Use toDate function to convert into unixtime then use plus function with milliseconds and finally use format function to get your desired format
Adding 1 day:
${date:toDate("yyyy-MM-dd"):toNumber():plus(86400000):format("yyyy-MM-dd")}
Example:
i'm having date attribute to the flowfile with value as 2018-01-10 and want's to add 1 day to the date attribute value.
Milliseconds for 1 day(24hr) is 86400000 so in the below expression i'm adding one day to the date attribute value.
Add new attribute in update attribute processor as
add_day and value as
${date:toDate("yyyy-MM-dd"):toNumber():plus(86400000):format("yyyy-MM-dd")}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With