# How to Add time to input\_datetime

**URL:** <https://discourse.nodered.org/t/how-to-add-time-to-input-datetime/84389>\
**Category:** General\
**Tags:** home-assistant\
**Created:** [8 January 2024 11:39 UTC](https://discourse.nodered.org/t/how-to-add-time-to-input-datetime/84389 "2024-01-08T11:39:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![EcarDK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ecardk/32/76058_2.png) [@EcarDK](https://discourse.nodered.org/u/EcarDK)\
**Post date:** [8 January 2024 11:39 UTC](https://discourse.nodered.org/t/how-to-add-time-to-input-datetime/84389/1 "2024-01-08T11:39:02Z")

</div>

Hallo all

How do I add one extra hour, in node-red, to an input input\_datetime.time.

If I set the time on the dashborad to like 20:00, and I need node-red to add one extra hour?

I need it to create a control where I can set a bedtime. I want to be able to set the bedtime on the dashboard, and then Node-RED should turn off some of the lights an hour later.

Thx alot all  
Peter

---

<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:** [8 January 2024 12:13 UTC](https://discourse.nodered.org/t/how-to-add-time-to-input-datetime/84389/2 "2024-01-08T12:13:03Z")

</div>

Maybe node-red-contrib-mytimeout could help. Take a look at it. I don't know how it will work with Home Assistant because I (and most people on the forum) don't use it

---

<div class="post-metadata">

**Author:** ![EcarDK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ecardk/32/76058_2.png) [@EcarDK](https://discourse.nodered.org/u/EcarDK)\
**Post date:** [8 January 2024 12:17 UTC](https://discourse.nodered.org/t/how-to-add-time-to-input-datetime/84389/3 "2024-01-08T12:17:52Z")

</div>

Hey Zenofmud  
Thx for the replay.

That was a good idea, but not exactly what I needed. If 20:00:00 is input, then I need the value to be 21:00:00.

I'm not proficient in function nodes, but perhaps there's an easy way to do it with function nodes.

---

<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:** [8 January 2024 12:59 UTC](https://discourse.nodered.org/t/how-to-add-time-to-input-datetime/84389/4 "2024-01-08T12:59:36Z")

</div>

Assuming that your system sends a message of some sort at bedtime, you could use a delay or trigger node without any time arithmetic. I think you would need to set msg.delay to 3600000 (1hr in milliseconds).

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

Does input\_datetime come from Home Assistant? What format is it? An example would be useful.

---

<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:** [8 January 2024 13:05 UTC](https://discourse.nodered.org/t/how-to-add-time-to-input-datetime/84389/5 "2024-01-08T13:05:31Z")

</div>

With my timeout you can specify the timeout in seconds and when it reaches that it sends out a message. I use it for my coffee pot timer. I can turn on the pot and 20 minutes later the pot is turned off.  
You can take a look at [Coffee Pot Timer](https://discourse.nodered.org/t/coffee-pot-timer/4743)

---

<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:** [8 March 2024 13:05 UTC](https://discourse.nodered.org/t/how-to-add-time-to-input-datetime/84389/6 "2024-03-08T13:05:52Z")

</div>

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