Sending timestamp to Google Sheets with correct timezone

I’m trying to send a timestamp to a Google Sheet. Therefore, I use the expression $now.format(“HH:mm”).toString(). In n8n, the timestamp looks correct (see screenshot).

However, in Google Sheets, the string value is 2 hours off (so it does not consider the timezone).

Any thought on how to solve this?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @strongbow,

  • To format a DateTime object based on the user’s locale settings:
    {{$now.format("HH:mm").toLocaleString()}}
  • If you want to specify a timezone:
    {{$now.setZone('America/New_York').format("HH:mm")}}

You can find more information on how to n8n handle date and time in the docs here: Handling dates | n8n Docs

Hope that helps!

Hey @aya, thanks for your response!
toLocaleString() didn’t work
setZone('Berlin/Europe') did work - although locale and timezone I set were the same.

Could you tell me what the output looks like when you try toLocaleString()

@strongbow Check this thread on using time and dates in n8n

2 Likes

this is great @Imperol!

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