# Ability to manipulate dates/times

**URL:** <https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245>\
**Category:** Demandes livrées\
**Created:** [July 3, 2023, 8:57am UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245 "2023-07-03T08:57:43Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [July 3, 2023, 8:57am UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/1 "2023-07-03T08:57:43Z")

</div>

Hi everyone,

I don’t know if this would be of great interest to you (but it means a lot to me ^^): would it be useful to be able to have date/time type values. Or even several types:

- date
- year
- month
- day
- hour
- minutes
- timestamp

I can see the usefulness for me to manage the timing for turning some devices on/off.  
For example, for my pool pump, I’d like to be able in Gladys (without using Node-RED, which sometimes requires knowledge I don’t have to create script snippets and functions) to create this kind of scene:

- Trigger at 8:00 AM
- Start filtration
- Retrieve pool temperature
- operation `T° piscine / 2` \> gives a value X (this gives me the required filtration duration in hours)
- Convert this value to minutes if needed
- Wait X minutes
- Stop filtration

I imagine there are many other use cases, particularly for managing durations.

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [July 3, 2023, 2:34pm UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/2 "2023-07-03T14:34:19Z")

</div>

I’m 100% for it too!! I’m exactly in the same situation, or almost!!  
My probe gives me an ideal daily filtration time that changes depending on the water temperature and the treatment (between 30 minutes per day and 3:00).  
But on my side, that’s also linked to another feature request to be able to write values from scenes…

Anyway I vote 😉😉

---

<div class="post-metadata">

**Author:** ![bertrandda](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/bertrandda/32/5929_2.png) [@bertrandda](https://community.gladysassistant.com/u/bertrandda)\
**Post date:** [July 27, 2023, 8:26pm UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/3 "2023-07-27T20:26:47Z")

</div>

Hello, date handling is a good idea.  
J’aimerais travailler sur le sujet, il se trouve que je suis également intéressé par des appareils pouvant stocker une date+heure (le timestamp seems the most suitable since it’s an integer type that can be easily saved), dans mon cas ce serait plutôt pour afficher des informations dans le dashboard (in x minutes, in y hours…)  
Can you tell me what you think is missing in your use case? Because in the scenario you describe above and that I’m trying to picture, the only thing missing to me are timestamp devices.  
Let me explain, in the example you give :

> [@guim31](#):
>
> - opération `T° piscine / 2` \> donne une valeur X (ça me donne la durée de filtration nécessaire en heures)
> - Convertir cette valeur en minutes si besoin
> - Attendre X minutes

However, the «&nbsp;wait X minutes&nbsp;» could be replaced by «&nbsp;wait until such date at such time&nbsp;» (in your scene it’s now + 2h for example) then trigger a second turn-off scene when we reach the timestamp time. I suggest this because imagine Gladys restarts during these 2-3 hours of waiting — how do we resume the scene where it left off.  
Of course we’ll need to add

- a way to trigger a scene on timestamp devices (a bit like calendar events essentially)
- a way to retrieve the current date and time in the «&nbsp;control a device&nbsp;» block  
For the date/time manipulation part, we already have the ability to do calculations in scenes — wouldn’t that answer your request if we associate it with a timestamp device?  
What do you think?

---

<div class="post-metadata">

**Author:** ![bong101](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/bong101/32/9808_2.png) [@bong101](https://community.gladysassistant.com/u/bong101)\
**Post date:** [September 15, 2023, 1:01pm UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/4 "2023-09-15T13:01:54Z")

</div>

Wait X minutes, X may be random ( between W and Y)

+1 for not using Node-Red

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 15, 2023, 1:11pm UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/5 "2023-09-15T13:11:28Z")

</div>

We might need to edit/recreate this request, because I don’t see anything concrete in the request 😅

Est-ce que si on devait écrire une seule ligne sur cette demande, la demande ne serait pas :

«&nbsp;Be able to inject a variable into the "Wait" action&nbsp;»:

![Screenshot 2023-09-15 at 15.10.36|690x403](upload://wwvj2rEvmDoVn5wDZGV

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [September 15, 2023, 1:42pm UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/6 "2023-09-15T13:42:21Z")

</div>

Shoot, I tried to be clear… 🫢 I guess it’s not that clear in my head!

The thing is, when I see your proposal it seems very coherent to me, but where does this variable come from?

In my example, I want to retrieve a temperature, apply a basic mathematical calculation to it to: divide, convert a time value (hour / minute / etc…) and then use that value in the WAIT block.

I don’t know what that kind of thing would entail.

Maybe I need to look at it more broadly and what I need is just a CALCULATION block that takes a base value and transforms it into a variable that we use later?

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 15, 2023, 1:47pm UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/7 "2023-09-15T13:47:59Z")

</div>

Look at the “control a device” action, you can perform a mathematical operation directly in the field 🙂

So it’s the same for “wait”, we could add variable injection and calculation

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [September 15, 2023, 1:51pm UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/8 "2023-09-15T13:51:47Z")

</div>

_Actually I wrote the message after checking…_  
_So there may be something I didn’t understand._

_If we allow variable injection in the WAIT field, can the scenario I described be applied in the scenes?_

EDIT : I misread your message so I’ll start again :

For me what’s intuitive is to retrieve a value, apply a calculation to it, and then use it.  
In what you propose, we retrieve a value, and it’s when using it (in the WAIT block) that we’ll apply the calculation to it, am I right?

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 15, 2023, 2:49pm UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/9 "2023-09-15T14:49:41Z")

</div>

> [@guim31](#):
>
> to apply a calculation to it and then use it

Yes, that’s what I’m proposing! Same functionality as in “control a device”

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [September 15, 2023, 2:57pm UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/10 "2023-09-15T14:57:34Z")

</div>

So in my scene I could do it like this (non-exhaustive example):

- get pool temperature
- WAIT block \> calculated value \> ` {{ temperature piscine }} / 2 * 60`

Am I right? Sorry, it looks like my brain is on strike today

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 18, 2023, 7:24am UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/11 "2023-09-18T07:24:01Z")

</div>

Yes, exactly! If that works for you, I suggest recreating a request with a title that says exactly that?

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [September 18, 2023, 9:22am UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/12 "2023-09-18T09:22:42Z")

</div>

Yes, of course — I was just about to ask you that. I’ll do it right away.

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 18, 2023, 9:48am UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/13 "2023-09-18T09:48:52Z")

</div>

OK, are you good with me closing this one?

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [September 18, 2023, 9:51am UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/14 "2023-09-18T09:51:21Z")

</div>

Yes, of course! People will have to change their votes 😉

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 18, 2023, 9:52am UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/15 "2023-09-18T09:52:09Z")

</div>

New request:

> [@Pouvoir injecter une variable dans l’action « Attendre »](https://community.gladysassistant.com/t/pouvoir-injecter-une-variable-dans-l-action-attendre/8363):
>
> Comme l’indique le titre, cela permettrait de mieux maitriser les délais d’attente dans les scènes. Pour pouvoir passer ce ça : A un fonctionnement identique à «&nbsp;contrôler un appareil&nbsp;» avec les champs suivants :

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 18, 2023, 9:52am UTC](https://community.gladysassistant.com/t/pouvoir-manipuler-des-date-heure/8245/16 "2023-09-18T09:52:12Z")

</div>


