Logic calculate split a string

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-16T14: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?

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

2 Likes

Thanks for your help @Boris_Fers this worked :smiley:

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.

1 Like

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

I also get quotation marks in the result variable.

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

1 Like

As an alternative you can use the equivalent flow card from the Better Logic Library.

1 Like

Create a numeric value (learned from Robert :wink:)

1 Like