How to reset time

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.


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.

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.

What will keep sending what data?

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.


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

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.

Perhaps a node-red-contrib-simple-gate node is what you want?

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

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

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.

[{"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":[]}]

Same thing without the Switch and Change nodes


[{"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":[]}]
1 Like


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. :man_facepalming: 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.

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))

1 Like

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

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.

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.

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

did you try the improved version suggested by Steve

Ok i will try later thanks.

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