Remove Date from Tide Sensor

          {% if is_state("sensor.filey_tide", "Falling") %}Low{% else %}High{%
          endif %} is {{ min(state_attr('sensor.filey_tide',
          'next_high_tide_at'), state_attr('sensor.filey_tide',
          'next_low_tide_at')) }}.

Currently, my tidal sensor outputs the full date and time - using the code above how would I get JUST the time?

Low is 2022-08-31 13:56:32

Low is 13:56:32

I’ve used this with much success to convert dates / times: The EPIC Time Conversion and Manipulation Thread!

Here’s an example of what I was playing with last night to help my daughter with her morning alarm:

{% set time = states('sensor.upbr_google_alarms') %}
{% set ftime = as_timestamp(time)|timestamp_custom('%-H:%M %p') %}
{{ time }}
{{ ftime }}

Resulting in:

6:05 AM

@Markus99 Thanks for this. Spent a couple of days on it and can’t seem to get this to work.


I just put this in my template editor:

{% set time = '2022-08-31 13:56:32'%}
{% set ftime = as_timestamp(time)|timestamp_custom('%-H:%M:%S') %}
{{ time }}
{{ ftime }}

resulting in:

I simply grabbed the date/time format you pasted in your original post.

You should be able to change the %-H:%M:%S using the link I posted previously to get to your desired format.