# Time confused? System is UTC, form entered time is local? But form returns wrong UTC encoding? Appears to be 1 hour off, like it is ignoring DST?

**URL:** <https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849>\
**Category:** General\
**Created:** [23 March 2023 04:05 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849 "2023-03-23T04:05:14Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [23 March 2023 04:05 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/1 "2023-03-23T04:05:14Z")

</div>

OK system is UTC as it should be, but when I enter say 9pm (local) on a NR form, UTC should 4am (where I am) but is shown as 5am, which means DST is ignored?

Form result for 9pm entered... 1970-01-02T05:00:00.000Z clearly that is not right.

I confirmed via UTC internet, 9am local should be 4am UTC, not 5am UTC. Any idea why this is happening?

System is correct...

# date  
Thu 23 Mar 2023 04:04:08 AM UTC

# date +"%Z %z"  
UTC +0000

So where is the NR form getting 5am for UTC?

---

<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:** [23 March 2023 07:13 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/2 "2023-03-23T07:13:18Z")

</div>

Exactly how are you entering the date and exactly how are you displaying it?  
Please post a simple flow for us to test.

What time zone is the machine running the browser set to?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 March 2023 07:33 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/3 "2023-03-23T07:33:59Z")

</div>

Probably related to this

> [@Node-red date picker issue](https://discourse.nodered.org/t/node-red-date-picker-issue/76567):
>
> I'm using node-red version 3.0.2. I observe that the date-picker node returns a random time on the date I select. This does not work for me (I want to add a specific time to the date). I observe that in github this problem was report on jul 10 of 2020 and was fixed, committed and merged the same day. But my installation is not doing what the committed code does (set hours, minutes, and seconds to 0 on the selected day). Does anyone know why this is not working and what I can do to get it to wor…

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [24 March 2023 07:14 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/4 "2023-03-24T07:14:08Z")

</div>

Type 9 tab 00 tab, arrow to select PM, enter, for 09:00 PM. I mean that is pretty straight forward right?

---

<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:** [24 March 2023 08:01 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/5 "2023-03-24T08:01:22Z")

</div>

Where have we got to do that? You haven't posted a flow.

> [@Colin](#):
>
> What time zone is the machine running the browser set to?

You haven't answered that question. It may be relevant.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [24 March 2023 13:46 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/6 "2023-03-24T13:46:04Z")

</div>

I already provided the time zone configuration see above. The flow is not relevant. Just create a form and add a time input control, and test it. See my original post, system is UTC, time entered is local, the resulting ISO time format string is 1 hour off what UTC should be, which is in my area is exactly off by local DST. The message that results I send to a UI table but watching it with a debug node, same result.

If I enter 9pm local, UTC should be 4am. This works in OS, as expected, but in NR, in a time control on a form, the resulting ISO string is 5am. That is 1 hour off, and we just shifted to DST a few weeks ago, I live in USA, CA. Could be a JavaScript bug? Quirk?

Input...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/6/2611ae70bf11078b273ca095555cd2c060d6b3c1.png)

Result...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c319f7b2e3bddb8a1706f71448fe67b92616a077.png)

Flow fragment...

```auto
[{"id":"a543d11d99499b0c","type":"ui_form","z":"4f2bc113e5ffb8b9","name":"Schedule","label":"Schedule","group":"a4af7f53ae04cc5e","order":5,"width":18,"height":1,"options":[{"label":"Task","value":"task","type":"text","required":true,"rows":null},{"label":"Active","value":"active","type":"checkbox","required":false,"rows":null},{"label":"Time","value":"time","type":"time","required":true,"rows":null},{"label":"Duration","value":"duration","type":"number","required":true,"rows":null},{"label":"Sunday","value":"sunday","type":"checkbox","required":false,"rows":null},{"label":"Monday","value":"monday","type":"checkbox","required":false,"rows":null},{"label":"Tuesday","value":"tuesday","type":"checkbox","required":false,"rows":null},{"label":"Wednesday","value":"wednesday","type":"checkbox","required":false,"rows":null},{"label":"Thursday","value":"thursday","type":"checkbox","required":false,"rows":null},{"label":"Friday","value":"friday","type":"checkbox","required":false,"rows":null},{"label":"Saturday","value":"saturday","type":"checkbox","required":false,"rows":null}],"formValue":{"task":"","active":false,"time":"","duration":"","sunday":false,"monday":false,"tuesday":false,"wednesday":false,"thursday":false,"friday":false,"saturday":false},"payload":"","submit":"Task","cancel":"Cancel","topic":"topic","topicType":"msg","splitLayout":"","className":"","x":180,"y":60,"wires":[["f3d65db0ba5ac41e"]]},{"id":"75dfd29e3fee10b4","type":"debug","z":"4f2bc113e5ffb8b9","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":460,"y":60,"wires":[]},{"id":"f3d65db0ba5ac41e","type":"link out","z":"4f2bc113e5ffb8b9","name":"link out 1","mode":"link","links":["639266f7bd0eee2c","22d4791030420326"],"x":285,"y":60,"wires":[]},{"id":"22d4791030420326","type":"link in","z":"4f2bc113e5ffb8b9","name":"link in 1","links":["220b94a29a114b28","f3d65db0ba5ac41e"],"x":345,"y":60,"wires":[["75dfd29e3fee10b4"]]},{"id":"a4af7f53ae04cc5e","type":"ui_group","name":"Irrigation","tab":"62b26ca3a854f6d1","order":1,"disp":true,"width":18,"collapse":true,"className":""},{"id":"62b26ca3a854f6d1","type":"ui_tab","name":"Garage","icon":"dashboard","disabled":false,"hidden":false}]

```

Note, in my original post, I note 9pm, but later in the post, 9am is noted, that is a typo, both 9 hour references should be PM. Consistent with the example provided above.

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [24 March 2023 17:33 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/7 "2023-03-24T17:33:11Z")

</div>

Does the same in the UK. Enter 19:30 and get 18:30 out. BST doesn't start until Sunday. Is it something to do with the fact that the date being used is `1970-01-0x`?

The reason for the 'x' in minutes, above the minutes are `02` and mine they are `1970-01-01T18:30:00.000Z`

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [24 March 2023 17:56 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/8 "2023-03-24T17:56:21Z")

</div>

> [@Buckskin](#):
>
> Does the same in the UK. Enter 19:30 and get 18:30 out. BST doesn't start until Sunday. Is it something to do with the fact that the date being used is `1970-01-0x`?

In the UK daylight saving time was in effect all year round in 1970.  
Even if you don't want to use the year part, you need to change it to this year to ensure the DST adjustment matches up to this year's calendar.

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [24 March 2023 19:51 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/9 "2023-03-24T19:51:12Z")

</div>

Yep, but with the Form time input you do not get a choice. This is the date used by the widget, that is what I think the problem is

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [24 March 2023 20:06 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/10 "2023-03-24T20:06:13Z")

</div>

There is a discussion of (probably) this topic at [https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/54](https://discourse.nodered.org/t/time-picker-in-ui-form-node-sends-wrong-time-in-output-payload/71296/54)

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [1 April 2023 04:22 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/11 "2023-04-01T04:22:34Z")

</div>

So... in short there is no way to address this? But to force the system clock to some odd offset or something other than UTC, so the forum time widget can be used effectively? I guess I could stop using the canned time widget and just use a text box? But then I would have to parse the input?

---

<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:** [31 May 2023 04:23 UTC](https://discourse.nodered.org/t/time-confused-system-is-utc-form-entered-time-is-local-but-form-returns-wrong-utc-encoding-appears-to-be-1-hour-off-like-it-is-ignoring-dst/76849/12 "2023-05-31T04:23:13Z")

</div>

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