Node - remove days from date

Hello everyone, it is a pleasure to start on n8n which is amazing and I would like to take a question.
I will receive a webhook with a future date.

Example:
format DD-MM-YYY

25/01/2020

I would like to always take this value (expression) from the webhook and remove 2 days.
The date I need would be:

23/01/2020

it’s possible? how?

Hi @Alexandre_Magno :wave:, welcome to the community!

You can do this using expressions in n8n. Here’s an example workflow that uses a Set node to stimulate the data coming from your Webhook node and another Set node that removes two days from the date.

Instead of expressions, you can also use the Function node for a better implementation than the one shown in the example above. If you are running a self-hosted version of n8n, you can also use built-in and external modules for easier manipulation of data.

You can find some handy JS snippets to use with n8n here. Hope that helps! :slight_smile:

3 Likes

With [email protected] an addition to the DateTime node got added which makes that now simpler.

1 Like