Trim number of characters from value

Hello everyone and happy new year :slight_smile: ,

I’d like to use a attribute from my xiaomi vacuum where is states the start and end of the latest cleaning cycle.
The format stated is “2019-01-01T13:11:17” but I’d like to trim all characters from T, so the sensor value would be “2019-01-01”.
What template code could I use for this?

You can play with the value in Dev Tools/Templates.

{% set value = '2019-01-01T13:11:17' %}
{{ value.split('T')[0] }}

returns 2019-01-01

1 Like

Found it. Thanks!