# Logic calculate split a string

**URL:** https://community.homey.app/t/logic-calculate-split-a-string/106329
**Category:** Questions & Help
**Tags:** logic
**Created:** [March 15, 2024, 12:50pm UTC](https://community.homey.app/t/logic-calculate-split-a-string/106329 "2024-03-15T12:50:10Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Goldunexist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/goldunexist/32/78869_2.png) [@Goldunexist](https://community.homey.app/u/Goldunexist)
#### Post date: [March 15, 2024, 12:50pm UTC](https://community.homey.app/t/logic-calculate-split-a-string/106329/1 "2024-03-15T12:50:10Z")

</div>

Hi Everyone,

I have a question about splitting a particular string.

The string that I have holds a date and time like this: 2024-03- **16** T **14:00** :00.000+01:00

Now I want to extract the day, the hour and the minutes.  
I found in another post something like {{ 0+(“”.split(“-”)[1]) }} in this way I get the year (2024) and for the month only the (3) but not the day (16). I cannot get the time at all.

I don’t have a homey pro or a bridge.  
Can somebody help me out to provide something that works?

---

<div class="post-metadata">

### Author: ![Boris\_Fers](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/boris_fers/32/74283_2.png) [@Boris\_Fers](https://community.homey.app/u/Boris_Fers)
#### Post date: [March 15, 2024, 3:17pm UTC](https://community.homey.app/t/logic-calculate-split-a-string/106329/2 "2024-03-15T15:17:52Z")

</div>

> [@Goldunexist](#):
>
> 2024-03- **16** T **14:00** :00.000+01:00

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/5/6551efd459318b53d7f665af17c5a9ecd72a6347.png)

You can also remove “0+” and you will get “01” in value. It depends on what you need.

---

<div class="post-metadata">

### Author: ![Goldunexist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/goldunexist/32/78869_2.png) [@Goldunexist](https://community.homey.app/u/Goldunexist)
#### Post date: [March 16, 2024, 6:57am UTC](https://community.homey.app/t/logic-calculate-split-a-string/106329/3 "2024-03-16T06:57:50Z")

</div>

Thanks for your help @Boris_Fers this worked 😃

---

<div class="post-metadata">

### Author: ![Andrew\_Whiteley](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/andrew_whiteley/32/79081_2.png) [@Andrew\_Whiteley](https://community.homey.app/u/Andrew_Whiteley)
#### Post date: [September 26, 2024, 10:15am UTC](https://community.homey.app/t/logic-calculate-split-a-string/106329/4 "2024-09-26T10:15:58Z")

</div>

Thank you very much for this - however, the variable it saves for me is in quotation marks when stored in the text variable. How do you save without them? Thanks in advance.

---

<div class="post-metadata">

### Author: ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)
#### Post date: [September 26, 2024, 10:22am UTC](https://community.homey.app/t/logic-calculate-split-a-string/106329/5 "2024-09-26T10:22:26Z")

</div>

> [@Andrew\_Whiteley](#):
>
> however, the variable it saves for me is in quotation marks when stored in the text variable

If you mean the “(a)Result” tag: it doesn’t contain quotation marks. Why do you think it does?

---

<div class="post-metadata">

### Author: ![Persan](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/persan/32/34391_2.png) [@Persan](https://community.homey.app/u/Persan)
#### Post date: [January 27, 2025, 5:06pm UTC](https://community.homey.app/t/logic-calculate-split-a-string/106329/6 "2025-01-27T17:06:41Z")

</div>

I also get quotation marks in the result variable.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/2/52228c8003d7dba2b2ddb87289bfab55f210e3f3.png)

---

<div class="post-metadata">

### Author: ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)
#### Post date: [January 27, 2025, 5:45pm UTC](https://community.homey.app/t/logic-calculate-split-a-string/106329/7 "2025-01-27T17:45:24Z")

</div>

I guess that flow card is broken then. You should contact Athom.

---

<div class="post-metadata">

### Author: ![SunBeech](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sunbeech/32/111391_2.png) [@SunBeech](https://community.homey.app/u/SunBeech)
#### Post date: [January 27, 2025, 6:05pm UTC](https://community.homey.app/t/logic-calculate-split-a-string/106329/8 "2025-01-27T18:05:17Z")

</div>

As an alternative you can use the equivalent flow card from the [Better Logic Library](https://homey.app/nl-nl/app/net.i-dev.betterlogic/Better-Logic-Library/).

---

<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: [January 27, 2025, 6:05pm UTC](https://community.homey.app/t/logic-calculate-split-a-string/106329/9 "2025-01-27T18:05:28Z")

</div>

Create a numeric value (learned from Robert 😉)

 ![1000042382](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/d/dda698a571d1248688b5ed6c1e5e41b4ab62bad9.jpeg)

 ![1000042380](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/5/95343ddcca89e68e2bb0a0bfdee6d634cf921df5.jpeg)
