Get current date() of specific timezone

How can I get the current date of a specific timezone, without using additional nodes?

I’m using {{new Date().toISOString()}} function inside my Set node expression, but it gives the UTC time, ignoring the environment variable I have set in my docker-compose with GENERIC_TIMEZONE=America/Anchorage

Thanks!

Hey pbdco,

Since you are already using GENERIC_TIMEZONE, try this:

{{$now}}

The GENERIC_TIMEZONE variable is taken into account when using Luxon instead of vanilla Javascript.

Check the documentation for more information about how Luxon works with n8n.

In case you want to have a more generic solution try the code snippet below:

{{$now.setZone('America/Anchorage')}}
5 Likes

This is exactly what I needed! Thank you for your kind and clear explanation!

2 Likes