How to format a date in a JSON?

Hello Community.

I have a JSON which cotains a field named “invoice_date”. I’m mapping this field in other module and I need it to be in a different date format than the original one.

What I map: “Date”: “{{$node[“Item Lists”].json[“appended_data”][0][“invoice_date”] }}”
What I receive: “Date”: “31/01/2023”
What I want to receive: “Date”: “2023-01-31”

Is there a way to change the format?

Thanks!

Hey @Lucas_Vargas,

Give the below a bash… The Item Lists node which is a sneaky Set node is just a copy of your data the second Set node is doing the magic, You can read a bit more about this here: Date and time with Luxon | n8n Docs

1 Like

Brilliant! Thank you for your answer. Problem solved. Have a nice day!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.