# Conversion of time variable "hh:mm" into 2 numeric variables hour and minutes, and vice versa

**URL:** <https://community.homey.app/t/conversion-of-time-variable-hh-mm-into-2-numeric-variables-hour-and-minutes-and-vice-versa/76785>\
**Category:** Questions & Help\
**Created:** [February 23, 2023, 10:57am UTC](https://community.homey.app/t/conversion-of-time-variable-hh-mm-into-2-numeric-variables-hour-and-minutes-and-vice-versa/76785 "2023-02-23T10:57:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Herve69](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/herve69/32/37183_2.png) [@Herve69](https://community.homey.app/u/Herve69)\
**Post date:** [February 23, 2023, 10:57am UTC](https://community.homey.app/t/conversion-of-time-variable-hh-mm-into-2-numeric-variables-hour-and-minutes-and-vice-versa/76785/1 "2023-02-23T10:57:18Z")

</div>

Hello everyone,

Does anyone know how to convert an Homey hour (for example the “hh:mm” current time given by Homey) to two numbers corresponding to the hour and the minute, and conversely, how to obtain an hour variable “hh:mm” with two numbers corresponding to the hour and the minutes?

For information, I’m looking for this to calculate the ideal time to start the filtration of my swimming pool according to the water temperature on the one hand, and the period of the day when my solar panels produce the most electricity on the other. Example: The maximum electricity production of the panels is at 11.30 am at my place. If ever the calculated time for filtration is 3 hours, then I start filtration at 11:30 - 3h/2 = 10:00, and I stop it at 11:30 + 3h/2 = 13:00 🙂

NB : I’ve read in some topics that Better Logic Library and / or Homeyscript could probably do this, but I really did not understand how to do this at all ☹

Thanks for your help !

---

<div class="post-metadata">

**Author:** ![OH2TH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/oh2th/32/111414_2.png) [@OH2TH](https://community.homey.app/u/OH2TH)\
**Post date:** [February 23, 2023, 12:51pm UTC](https://community.homey.app/t/conversion-of-time-variable-hh-mm-into-2-numeric-variables-hour-and-minutes-and-vice-versa/76785/2 "2023-02-23T12:51:37Z")

</div>

Hi

I’m doing something similar here, but to heat up the outdoor spa:

[Setting a dynamic start time](https://community.homey.app/t/app-pro-action-scheduler-alarm-utilities/75592#setting-a-dynamic-alarm-time-11)

If you have a constant of 3 hours for the filtration then you. An use the Scheduler device’s action card for ” Schedule ahead of time” similar to the flow sample:

Schedule 90 minutes before 11:30 and repeat on …

Now if you have formula to get the number of minutes for your filter cycle, you can put that in a BLL expression (as a tag) Math.round((your formula for filter cycle in minutes)/2)

---

<div class="post-metadata">

**Author:** ![Herve69](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/herve69/32/37183_2.png) [@Herve69](https://community.homey.app/u/Herve69)\
**Post date:** [February 23, 2023, 2:02pm UTC](https://community.homey.app/t/conversion-of-time-variable-hh-mm-into-2-numeric-variables-hour-and-minutes-and-vice-versa/76785/3 "2023-02-23T14:02:41Z")

</div>

Hi Tapio,

I had a look at you post and the app, and yes, I think it could be the solution 🙂

So I’ll try to do the flows and let you know.

Thanks a lot !

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [February 23, 2023, 10:47pm UTC](https://community.homey.app/t/conversion-of-time-variable-hh-mm-into-2-numeric-variables-hour-and-minutes-and-vice-versa/76785/5 "2023-02-23T22:47:29Z")

</div>

> [@Conversion variable heure "hh:mm" en 2 variables numériques heure et minutes, et vice-versa](https://community.homey.app/t/conversion-variable-heure-hh-mm-en-2-variables-numeriques-heure-et-minutes-et-vice-versa/76756/6):
>
> I am sorry, i do not speak or write French, so i’ll do this in English. If i understand you correct, i think you might like the format card in the [Better Logic Library App](https://homey.app/nl-nl/app/net.i-dev.betterlogic/). [[APP][Pro] Better Logic Library - For Users - Apps - Homey Community Forum](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876/2) it has a Format card which gives parts of the date exactly how you want it, based on your locale settings and timezone (configurable through the settings): [image] (You can type anything you like it in and select the top one, which is what you typ…

---

<div class="post-metadata">

**Author:** ![Herve69](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/herve69/32/37183_2.png) [@Herve69](https://community.homey.app/u/Herve69)\
**Post date:** [February 24, 2023, 9:46am UTC](https://community.homey.app/t/conversion-of-time-variable-hh-mm-into-2-numeric-variables-hour-and-minutes-and-vice-versa/76785/6 "2023-02-24T09:46:22Z")

</div>

For those who are interested, here are my flows using the Action Scheduler app :

 ![flows](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/c/2ce21cbb4054acc87c95dc40d821ad440529d134.jpeg)

I could have done this using BLL but I’ve choosen Action Scheduler as I find it much easier to use for people like me who do not know anything about IT coding ^^

Once again, thanks @OH2TH🙂

---

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [February 25, 2023, 2:45pm UTC](https://community.homey.app/t/conversion-of-time-variable-hh-mm-into-2-numeric-variables-hour-and-minutes-and-vice-versa/76785/7 "2023-02-25T14:45:24Z")

</div>

I use two separate variables: HourOfTheDay. I set it every hour to stay accurate if Homey has rebooted, and every 3 minutes I add 0.05 to the value.  
The second variable is CumulativeHours. I add the same 0.05 every 3 minutes, but I can use this value for less time sensitive stuff for which I don’t want to run timers (and prevent the loss of timers when Homey reboots). This variable also doesn’t have any complications with the next day when using logic. If I want to know if an event happened 20 hours ago, the logic is always simple.

---

<div class="post-metadata">

**Author:** ![Herve69](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/herve69/32/37183_2.png) [@Herve69](https://community.homey.app/u/Herve69)\
**Post date:** [February 25, 2023, 4:34pm UTC](https://community.homey.app/t/conversion-of-time-variable-hh-mm-into-2-numeric-variables-hour-and-minutes-and-vice-versa/76785/8 "2023-02-25T16:34:59Z")

</div>

Thanks, this is really a very simple solution without any App to use and no timer too 👍

---

<div class="post-metadata">

**Author:** ![DoctorBazinga](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/doctorbazinga/32/39686_2.png) [@DoctorBazinga](https://community.homey.app/u/DoctorBazinga)\
**Post date:** [January 10, 2025, 11:18pm UTC](https://community.homey.app/t/conversion-of-time-variable-hh-mm-into-2-numeric-variables-hour-and-minutes-and-vice-versa/76785/9 "2025-01-10T23:18:42Z")

</div>

@Arie_J_Godschalk

Sorry ! But I don’t understand this.

I need your help.

I have a value of “_remaining time_” value/property the (samsung) washing machine as HH:mm and would need it to split up in hours and minutes for TTS & push notifications.  
Now its its read als a time. eg 01:50 is read as 10 minutes to 2 am o’clock instead of 1 hour and 50 minutes by google and alexa TTS.

Please give me the exact code / expression and flow pieces to add in my flow

Thank You.
