Add Year +1 from current date

With the Help of Date & Time Node, I’m converting from Date from UTC.

Here is What I want to achieve:

I want to get Year +1 that will be 15-10-2021 and store in SET Node.

(Date is coming from WooCommerece Trigger)

Can this be done with Function Node?

Screenshot from 2020-10-16 10-25-45

And here is the Output of Date and Time Node

Screenshot from 2020-10-16 07-22-44

I recommend you to add a function item after creating json.

Add a new property to the item this way

item.year = new Date().getFullYear();
return item;

Hey @Miquel_Colomer Thanks for replying.

I updated the question.

No idea @mcnaveen. I haven’t used that node sorry :frowning:

No Problem Buddy.

I think @RicardoE105 or @tanay can help.

Not sure if I understand your question. Date is today in a year or is it coming from the WooCommerce node? You want to specifically do it in a Set, Function or Date&Time Node?

To get the date today in one year you can set this in a “Date & Time” Node:

{{ new Date(new Date().getTime() + (365*24*60*60*1000)).toISOString() }}

If you want the date in a year from a given date saved in the property someProperty it would be this:

{{ new Date(new Date($json.someProperty).getTime() + (365*24*60*60*1000)).toISOString() }}

Here an example node with the first example:

{
  "nodes": [
    {
      "parameters": {
        "value": "={{ new Date(new Date().getTime() + (365*24*60*60*1000)).toISOString() }}",
        "custom": true,
        "toFormat": "DD-MM-YYYY",
        "options": {}
      },
      "name": "Date & Time",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    }
  ],
  "connections": {}
}

This worked bro. @jan

Ok, then I guess my above post answered the question. You just have to change it to:

{{ new Date(new Date($json.date_created).getTime() + (365*24*60*60*1000)).toISOString() }}

Did not get your message displayed.

Yes exactly. Except for changing the property-name.

Yes. I did changed the Property Name and It worked.

Thanks @jan