# Remove colon from Time

**URL:** <https://community.homey.app/t/remove-colon-from-time/84949>\
**Category:** Questions & Help\
**Created:** [July 20, 2023, 4:09pm UTC](https://community.homey.app/t/remove-colon-from-time/84949 "2023-07-20T16:09:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnt\_Soloy](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arnt_soloy/32/58318_2.png) [@Arnt\_Soloy](https://community.homey.app/u/Arnt_Soloy)\
**Post date:** [July 20, 2023, 4:09pm UTC](https://community.homey.app/t/remove-colon-from-time/84949/1 "2023-07-20T16:09:59Z")

</div>

I am trying to store a number in a virtual device, but none supports time format. So  
i want to store it as a number instead, like 17:22 to 1722. Or just the 2 last digits?  
Any chance this could be done through logic or something?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [July 20, 2023, 5:19pm UTC](https://community.homey.app/t/remove-colon-from-time/84949/2 "2023-07-20T17:19:49Z")

</div>

You can convert it with Homeyscript in AdvancedFlow:  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/e/fe3fa34e3b9ba551acf69a8f78067d274c207214.png)

This card takes a input token, replaces the “:” and returns a number. Place your time token in teh highlighted field.  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/f/5fe3c319b6921463c82b743149af8045f74b6fc2.png)

```auto

return Number(args[0].replace(':', ''));

```

---

<div class="post-metadata">

**Author:** ![Arnt\_Soloy](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arnt_soloy/32/58318_2.png) [@Arnt\_Soloy](https://community.homey.app/u/Arnt_Soloy)\
**Post date:** [July 20, 2023, 5:33pm UTC](https://community.homey.app/t/remove-colon-from-time/84949/3 "2023-07-20T17:33:52Z")

</div>

Ty for the script example. Tested it and i get the correct output as a number.  
But then, how can i take that number and store it into a virtual device?  
I am trying to store it as a power number in a virtual lamp.

Update: figured it out. Flow tag from the script did show up at the top of the tag selection.

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [July 20, 2023, 6:16pm UTC](https://community.homey.app/t/remove-colon-from-time/84949/4 "2023-07-20T18:16:06Z")

</div>

That depends on the app you used for virtual devices and the capability used (numeric like measure\* ?).

---

<div class="post-metadata">

**Author:** ![Arnt\_Soloy](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arnt_soloy/32/58318_2.png) [@Arnt\_Soloy](https://community.homey.app/u/Arnt_Soloy)\
**Post date:** [July 20, 2023, 6:17pm UTC](https://community.homey.app/t/remove-colon-from-time/84949/5 "2023-07-20T18:17:02Z")

</div>

I figured it out, se update above.  
Ty so much for the help 🙂

---

<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:** [July 20, 2023, 8:56pm UTC](https://community.homey.app/t/remove-colon-from-time/84949/6 "2023-07-20T20:56:14Z")

</div>

You can also use the Foemat date flowcard from BetterLogicLibrary with format HHmm.

---

<div class="post-metadata">

**Author:** ![Arnt\_Soloy](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arnt_soloy/32/58318_2.png) [@Arnt\_Soloy](https://community.homey.app/u/Arnt_Soloy)\
**Post date:** [July 20, 2023, 9:06pm UTC](https://community.homey.app/t/remove-colon-from-time/84949/7 "2023-07-20T21:06:50Z")

</div>

I did try that before this topic was created, and i made a “minutt” format using “mm”.  
It ended there as i could not figure out how to use that in the flow.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [July 20, 2023, 11:09pm UTC](https://community.homey.app/t/remove-colon-from-time/84949/8 "2023-07-20T23:09:54Z")

</div>

For you and anyone else interested, I felt like visualizing the BLL flow possibility in addition to the solutions posted here.

The BLL card ‘Format date as …’ returns the result of your entered format right away as you type:

 ![Screenshot from 2023-07-21 00-59-58](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/c/9c47a3eec30c58ebaa5a3405eb3f164c81454ec9.png)

To save the time without colon as numeric variable:

 ![Screenshot from 2023-07-21 01-03-15](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/f/9f4271b1eded28cd8319769afafc47d24cc74063.png)

---

<div class="post-metadata">

**Author:** ![Arnt\_Soloy](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arnt_soloy/32/58318_2.png) [@Arnt\_Soloy](https://community.homey.app/u/Arnt_Soloy)\
**Post date:** [July 21, 2023, 7:11am UTC](https://community.homey.app/t/remove-colon-from-time/84949/9 "2023-07-21T07:11:46Z")

</div>

Nice example, finaly got to see how it worked. Ty for that.

Below is how i used the homeyscript solution + how your example also could be used.

> **[Screenshot](https://prnt.sc/Xn74aX6X1E_r)**
>
> Captured with Lightshot

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [July 21, 2023, 10:44am UTC](https://community.homey.app/t/remove-colon-from-time/84949/10 "2023-07-21T10:44:12Z")

</div>

YW. Arnt,

Yeah, the advantage of the HS cards is it returns a numeric tag right away, albeit a local (flow only) tag.

But I can imagine folks not wanting to use HS cards (yet) 😜

---

<div class="post-metadata">

**Author:** ![Arnt\_Soloy](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arnt_soloy/32/58318_2.png) [@Arnt\_Soloy](https://community.homey.app/u/Arnt_Soloy)\
**Post date:** [July 21, 2023, 1:20pm UTC](https://community.homey.app/t/remove-colon-from-time/84949/11 "2023-07-21T13:20:43Z")

</div>

I ended up using the BetterLogicLibrary, as it turnes out i could not save a converted time with a 0 at the begining, like 0922. It would save it as 922. Using BLL i formated time using “m” not “mm”. If i understand this correctly, it will return a number as 5, instead of 05.

---

<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:** [July 22, 2023, 6:56am UTC](https://community.homey.app/t/remove-colon-from-time/84949/12 "2023-07-22T06:56:33Z")

</div>

> [@Arnt\_Soloy](#):
>
> If i understand this correctly, it will return a number as 5, instead of 05.

Indeed!
