Strptime help

Hi, having issues using the strptime function. I’m trying to extract the time out of a datetime that starts off as a string. I successfully converted the sensor from string into a date and time.

The issue I’m having is extracting the time then applying an offset. I think I need to use the strptime function but not 100% sure. I tried this but no luck:

{% set date_string = states('sensor.wilke_dishwasher_remaining_program_time')|as_datetime|relative_time %} 
{{ strptime(date_string, '%H:%M:%S') }}

I’m also very new at templates in general. There were some similar topics but nothing that let me put it all together. Any help is appreciated.

{{ states('sensor.wilke_dishwasher_remaining_program_time') | as_timestamp | timestamp_custom('%H:%M:%S') }}

That did the trick. Thank you!

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.