Convert timestamp from GMT to Brazil -3h timezone

Hey @Jon @fxholl
it’s not that easy because n8n is not passing the data as luxon date object but instead as string.
You need to convert the string first and then change the timezone. I chose Buenos Aires, but feel free to change it to the capital next to you. Afterwards we need to format the date back to string with correct format.

@fxholl you can just copy the Set node from my workflow, put it before the send to komercial node and then you have the gmt-3 date within the usable attributes.

This is the needed code:

{{ DateTime.fromFormat($json['Submitted At'], 'yyyy-MM-dd HH:mm:ss', { zone: 'utc' }).setZone('America/Argentina/Buenos_Aires').toFormat('yyyy-MM-dd HH:mm:ss') }}

And here you find the formatted date.

Hope that helps.

Cheers

2 Likes