# NR runs on wrong time zone

**URL:** https://discourse.nodered.org/t/nr-runs-on-wrong-time-zone/95593
**Category:** General
**Created:** [23 February 2025 17:37 UTC](https://discourse.nodered.org/t/nr-runs-on-wrong-time-zone/95593 "2025-02-23T17:37:10Z")
**Posts on this page:** 6
**Page:** 2

<div class="post-metadata">

### Author: ![ThingsTinkerer](https://avatars.discourse-cdn.com/v4/letter/t/91b2a8/32.png) [@ThingsTinkerer](https://discourse.nodered.org/u/ThingsTinkerer)
#### Post date: [25 February 2025 01:04 UTC](https://discourse.nodered.org/t/nr-runs-on-wrong-time-zone/95593/21 "2025-02-25T01:04:18Z")

</div>

Yup I use the frequently for numbers as well.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [27 February 2025 14:42 UTC](https://discourse.nodered.org/t/nr-runs-on-wrong-time-zone/95593/22 "2025-02-27T14:42:00Z")

</div>

@ruffieuxh is everything clear now?

---

<div class="post-metadata">

### Author: ![ruffieuxh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ruffieuxh/32/63479_2.png) [@ruffieuxh](https://discourse.nodered.org/u/ruffieuxh)
#### Post date: [5 March 2025 14:08 UTC](https://discourse.nodered.org/t/nr-runs-on-wrong-time-zone/95593/23 "2025-03-05T14:08:12Z")

</div>

Many thanks Colin,

Sorry for not replying earlier. Somehow I did not get the e-mail notifications...

Yes, clear in principle. I understand, that the system time is always UTC, but the debug node results depend on how (in what form) you present them.

One last question:

If we have this time situation in a GMT+1 timezone: 16:54 UTC and 17:54 GMT+0100 and I do a time comparison in a function node (i.e. if the current time is between 12:00 and 18:00) which one would be used UTC or GMT+1 time **for the current time** (i.e. new Date())?

---

<div class="post-metadata">

### Author: ![ThingsTinkerer](https://avatars.discourse-cdn.com/v4/letter/t/91b2a8/32.png) [@ThingsTinkerer](https://discourse.nodered.org/u/ThingsTinkerer)
#### Post date: [5 March 2025 14:51 UTC](https://discourse.nodered.org/t/nr-runs-on-wrong-time-zone/95593/24 "2025-03-05T14:51:54Z")

</div>

You implicitly or explicitly choose which timezone you want to compare against. Recommend playing around with it in vscode or some other js sandbox (can recommend [JavaScript Playground](https://playcode.io/javascript). It was the only way for me to learn (by doing).

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [5 March 2025 15:45 UTC](https://discourse.nodered.org/t/nr-runs-on-wrong-time-zone/95593/25 "2025-03-05T15:45:37Z")

</div>

> [@ruffieuxh](#):
>
> If we have this time situation in a GMT+1 timezone: 16:54 UTC and 17:54 GMT+0100 and I do a time comparison in a function node (i.e. if the current time is between 12:00 and 18:00) which one would be used UTC or GMT+1 time **for the current time** (i.e. new Date())?

The two times are the same time, there is no time difference. If you had them in two Date objects and compared them they would be equal.

If you want to test whether the _time of day_ now is between 12:00 and 18:00 _local_ time then you can use `new Date()` which will give you the current time, then you can use something like

```auto
const now = new Date()
const hours = now.getHours() // this returns the hour of the day in the local time zone
const minutes = now.getMinutes() // the minutes in that hour

```

See [Date.prototype.getHours() - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getHours) for the docs for the Date methods.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [3 June 2025 15:46 UTC](https://discourse.nodered.org/t/nr-runs-on-wrong-time-zone/95593/26 "2025-06-03T15:46:26Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/nr-runs-on-wrong-time-zone/95593.md?page=1)
