# How to reset time

**URL:** <https://discourse.nodered.org/t/how-to-reset-time/66441>\
**Category:** General\
**Created:** [15 August 2022 11:53 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441 "2022-08-15T11:53:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelvin](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kelvin](https://discourse.nodered.org/u/kelvin)\
**Post date:** [15 August 2022 11:53 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/1 "2022-08-15T11:53:33Z")

</div>

Hi Everyone,

I'm here for asking how to i reset the time?  
Examples: when i inject a timestamp from 8 a.m to 5 p.m and the debug will give me Singapore time and the date.

When after 5 p.m will auto reset the time, will be continuously for the next day.

Thanks

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [15 August 2022 12:33 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/2 "2022-08-15T12:33:48Z")

</div>

Hi Kelvin, not sure I really understand your issue. Could you post some screen-shots to illustrate it?

Node-RED simply uses the underlying OS time settings so you should check those too.

---

<div class="post-metadata">

**Author:** ![kelvin](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kelvin](https://discourse.nodered.org/u/kelvin)\
**Post date:** [15 August 2022 13:26 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/3 "2022-08-15T13:26:53Z")

</div>

Hi,  
below this picture take this as example  
after i inject start maybe around 8 a.m than will keep sending the data until 5 p.m than will be auto reset the timing.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/9/6915356ea306504f9acdca72a7c78f438c6218c4.png)

---

<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:** [15 August 2022 14:19 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/4 "2022-08-15T14:19:27Z")

</div>

> [@kelvin](#):
>
> will keep sending the data

What will keep sending what data?

---

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [15 August 2022 14:22 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/5 "2022-08-15T14:22:04Z")

</div>

It seems to me what he wants is a window of 8am to 5pm when data will be sent or time is sent? I'll be interested in seeing the answer to @Colin questiom.

---

<div class="post-metadata">

**Author:** ![kelvin](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kelvin](https://discourse.nodered.org/u/kelvin)\
**Post date:** [17 August 2022 02:34 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/6 "2022-08-17T02:34:37Z")

</div>

Hi,

my issue is when i on the elapsed time will continuously counting the time, when is off i wanted to have 1 debug node only.  
but not i can't find the easy way for this.

Thank you

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

---

<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:** [17 August 2022 06:18 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/7 "2022-08-17T06:18:34Z")

</div>

I am sorry, that sentence does not make sense. I presume that the problem is that English is not your first language. Please try and explain in a lot more detail what you want to do. Perhaps then we can understand.  
Also tell us what your first language is, perhaps someone here understands it.

---

<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:** [17 August 2022 06:41 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/8 "2022-08-17T06:41:50Z")

</div>

Perhaps a [node-red-contrib-simple-gate](https://flows.nodered.org/node/node-red-contrib-simple-gate) node is what you want?

 ![Untitled 2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/6/66a4b6b4296f87d8c15539967bf87fc370d256d2.jpeg)

You can open and close the gate at specific times, maybe using your "timerswitch" node.

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [17 August 2022 07:18 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/9 "2022-08-17T07:18:58Z")

</div>

i had made a simple flow for some requirement, i am not entirely sure is this what the OP wants, but nonetheless.

> [@Daily Schedule with Gate Control](https://discourse.nodered.org/t/daily-schedule-with-gate-control/56125):
>
> [{"id":"ce75c26918b78527","type":"gate","z":"c83d72886d5b02c0","name":"","controlTopic":"control","defaultState":"closed","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"status","persist":false,"storeName":"default","x":960,"y":310,"wires":[[]]},{"id":"0878e020e1a53ff7","type":"inject","z":"c83d72886d5b02c0","name":"Open Gate","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"co…

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [17 August 2022 07:39 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/10 "2022-08-17T07:39:04Z")

</div>

The below flow will give one output every minute between 08:00 and 17:00 and one output only once at 17:00.  
you need to install `node-red-contrib-cron-plus` for this.

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

```auto
[{"id":"6730fda3df8bc09d","type":"change","z":"b4466d762546d11c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"The Time is 17:00 Now","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":120,"wires":[["1ddb4485cfcd9596"]]},{"id":"61869761095561a5","type":"switch","z":"b4466d762546d11c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"A","vt":"str"},{"t":"eq","v":"B","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":370,"y":100,"wires":[["6332ee2f0b0b2e3d"],["6730fda3df8bc09d"]]},{"id":"1ddb4485cfcd9596","type":"debug","z":"b4466d762546d11c","name":"debug 19","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":760,"y":140,"wires":[]},{"id":"6f40b9cda9c211cd","type":"cronplus","z":"b4466d762546d11c","name":"","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"str","payload":"A","expressionType":"cron","expression":"0 */1 8-16 * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"name":"schedule2","topic":"topic2","payloadType":"str","payload":"B","expressionType":"cron","expression":"0 0 17 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":200,"y":100,"wires":[["61869761095561a5"]]},{"id":"6332ee2f0b0b2e3d","type":"change","z":"b4466d762546d11c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"The Time is between 08:00 and 17:00","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":80,"wires":[["45af6e17ad6e8334"]]},{"id":"45af6e17ad6e8334","type":"debug","z":"b4466d762546d11c","name":"debug 18","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":760,"y":60,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 August 2022 07:49 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/11 "2022-08-17T07:49:21Z")

</div>

Same thing without the Switch and Change nodes

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/7/975241c3e652ce4e75635c3ccc126c70fb49dc1d.png)

```auto
[{"id":"1ddb4485cfcd9596","type":"debug","z":"39535495.99fe8c","name":"debug 19","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1520,"y":258,"wires":[]},{"id":"6f40b9cda9c211cd","type":"cronplus","z":"39535495.99fe8c","name":"","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"fanOut","outputs":4,"options":[{"name":"schedule1","topic":"topic1","payloadType":"str","payload":"The Time is between 08:00 and 17:00","expressionType":"cron","expression":"0 */1 8-16 * * *","location":"The Time is between 08:00 and 17:00","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"name":"schedule2","topic":"topic2","payloadType":"str","payload":"The Time is 17:00 Now","expressionType":"cron","expression":"0 0 17 * * * *","location":"B","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":1300,"y":260,"wires":[["45af6e17ad6e8334"],["1ddb4485cfcd9596"],[],[]]},{"id":"45af6e17ad6e8334","type":"debug","z":"39535495.99fe8c","name":"debug 18","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1520,"y":211,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [17 August 2022 08:00 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/12 "2022-08-17T08:00:05Z")

</div>

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

Have been using cron plus for quite some time now, never occured to me i can have independent outputs from cron plus for every schedule. 🤦‍♂️ I have created multiple cron-plus nodes across my flows. Is there any significant cpu power lost in multiple nodes working instead of one node with multiple schedules ?  
thanks for this.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/8/48be2aadcd30d535fa16c775963c313d5d9aae4c.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 August 2022 08:15 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/13 "2022-08-17T08:15:17Z")

</div>

> [@smanjunath211](#):
>
> Is there any significant cpu power lost in multiple nodes working instead of one node with multiple schedules ?

no, either way, the difference is insignificant (but technically, fan out is less overhead due to zero comparisons (switch node) and less routes (less clones))

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [17 August 2022 09:59 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/14 "2022-08-17T09:59:26Z")

</div>

Thanks and Sorry for sidetracking the original post. hope the orginal post uses this conversation and finds relevant solution

---

<div class="post-metadata">

**Author:** ![kelvin](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kelvin](https://discourse.nodered.org/u/kelvin)\
**Post date:** [18 August 2022 02:24 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/15 "2022-08-18T02:24:10Z")

</div>

Hi Jbudd,

for your flow can automatic open and close?  
cause i using gate also but only have to manual go and change open or close  
cause i finding the way can automatic after off can cutoff the time.  
any way thanks for respond.

---

<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:** [18 August 2022 08:20 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/16 "2022-08-18T08:20:18Z")

</div>

> [@kelvin](#):
>
> for your flow can automatic open and close?

Yes, of course.

Inject nodes can open and close the gate at specific times.

Your START button together with a trigger can open the gate and close it after a defined period.

Your START button together with a trigger can open the gate and close it if no further messages have been received for a defined period.

And many other possibilities.

---

<div class="post-metadata">

**Author:** ![kelvin](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kelvin](https://discourse.nodered.org/u/kelvin)\
**Post date:** [18 August 2022 08:43 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/17 "2022-08-18T08:43:53Z")

</div>

Do you mind can send me your flow, so than i can take a experience from there.

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [18 August 2022 08:55 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/18 "2022-08-18T08:55:23Z")

</div>

did you try the improved version suggested by Steve

> [@Steve-Mcl](#):
>
> Same thing without the Switch and Change nodes

---

<div class="post-metadata">

**Author:** ![kelvin](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kelvin](https://discourse.nodered.org/u/kelvin)\
**Post date:** [18 August 2022 09:05 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/19 "2022-08-18T09:05:56Z")

</div>

Ok i will try later thanks.

---

<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:** [17 October 2022 09:06 UTC](https://discourse.nodered.org/t/how-to-reset-time/66441/20 "2022-10-17T09:06:56Z")

</div>

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