Sending dates to Salesforce Timezone issue

I am currently testing out n8n in order to verify if its suitable for company use. It needs to send data with a Salesforce node. The problem is, that since the Winter time in germany, the date sent to salesforce is off.

This is the Input/Output of the salesforce node:

I need to send a date which should be correctly: (mm.dd.yyyy hh:mm) 23.12.2024 08:00

The “Ankunftstermin” is supposedly sent as “2024-12-23T07:00:00.000+0000”.
Which seems to be correct, since the timezone will be handled in Salesforce.
I tried with “2024-12-23T07:00:00.000Z” too, as seen in the “Abholtermin” with no changes to the problem.

The salesforce TZ is set to Europe/Berlin aswell as the N8n workflow.

The time now appears as 23.12.2024 09:00 in salesforce. After contacting salesforce and trying to find out if the issues is on their end, they denied and proved me wrong.
Since i can send the exact same date string (2024-12-23T07:00:00.000+0000 ( or with Z) )
via a HTTP Request client and it appears correctly in Salesforce.

I suspect n8n to modify my date now.

What can I do to debug this more and make it clear to gather some help?
It seems to somewhat specific to timezones, but changing the timezone in n8n doesnt help either. Salesforce inserts the date sent with one hour off already, resulting in +2 hours in the UI then (Since my UI is set to gmt+1 germany). But that shouldnt be the case as mentionen with the HTTP Request done manually sending the same data.

Unfortunately, sharing the whole Workflow is not possible and hopefully not necessary.

Information on the n8n setup

  • n8n version: 1.29.1
  • Database (default: SQLite): default/not changed
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Default/Not changed
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Linux

Welcome to the community @Joe0x01 !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.

Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!


n8n manages two types of timezone controlled by two corresponding environmental variables, namely

  • GENERIC_TIMEZONE: to control time for the triggers and crons
  • TZ: system time to present the time in UI

See Docker | n8n Docs.

Moreover, each workflow could have its own timezone set via workflow settings (meaning it will override TZ set during deployment or the default value if not used). This controls how the n8n variables such as $now and $today present the datetime values.

When you use Date() the date string is converted to the timezone set in your system where you host n8n. It also depends on the string representation of the date you are casting to Date object (whether it includes timezone or not).

See how the time changes depending on differemt conditions.

I would additionally advise working with Luxon Date object as it is more flexible in manipulation, Handling dates | n8n Docs.

Salesforce supported format: Salesforce Developers.

1 Like

Hello ihortom, thanks for the warm welcome.

I am a mix of glad and ashamed, after even having a face to face meeting with salesforce, to confirm using Luxon with proper setup works.

I am using it like this with the explicit Timezone setting to make sure:

{{ DateTime.fromFormat($('Code').item.json.termine[0].end_date_time, "yyyy-MM-dd HH:mm:ss", { zone: "Europe/Berlin" }).toISO() }} 

This also transfers the date correctly to salesforce.

Best Regards.

1 Like

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