IF time check incorrect



Can anyone suggest why my state is false?

If I use {{ Number(new Date().getHours()) }} the result is the same

Hi @axelandpixel3 :wave: Welcome to the community :tada:

I just tried the same expression (and just simply {{ new Date().getHours() }}

and am getting true, as expected:

Which version of n8n are you on, and how are you running n8n? The information in the template we ask for is a bit important here :sweat_smile:

Sorry :sweat_smile:

  • n8n version: - Version 0.228.2
  • Database (default: SQLite): - default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): - main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): - Docker, image n8nio/n8n
  • Operating system: - Debian 10

Hmm, I’m not running into this on that version, either :thinking: Could you share your full workflow with us by following these instructions? Export and import | n8n Docs

If you put the json code between two sets of three backticks (```) that’d be perfect!

i create new workflow and problem saved.

if value1 = 13 and value2 = 10 it’s retrun true, but if value1 = 13 and value2= 11 it’s return false

Now value1 = 14 for me, and if value2 = 11 it’s return true, but if value2 = 12 its return false.

Could it be a time zone issue? Maybe in the interface I see one result of time calculations, but “under the hood” it is completely different?

Hi @axelandpixel3 , I’m not sure but it’s possible as I’ve seen timezones cause strange issues before - do you have a specific timezone set for your environment in your Docker file? You can add this line with the correct timezone to your Docker compose file with the timezone you’re in, and that might make a difference.

1 Like


I solved my problem. Need to use {{$now.hour}} instead of new Date().getHours().
Thanks for your help and responsiveness! Have a nice day, it was fun :slight_smile:


No problem @axelandpixel3 - glad you figured it out! :smiley:


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