How do I get leading zero in my timeformat

I have make a sensor where I use the value from my time helper and subtract 15 min.

In my helper the time selected is 05:30

My sensor show 5:30:00 without the leading zero.

How do I solve this ?

- platform: template
    sensors:
      frost_check:
        friendly_name: "Frosttid"
        value_template: "{{ strptime(states('input_datetime.alarmtid'), '%H:%M:%S') - strptime('15', '%M') }}"


This should do the trick:

- platform: template
    sensors:
      frost_check:
        friendly_name: "Frosttid"
        value_template: "{{ (state_attr('input_datetime.alarmtid', 'timestamp') - 900) | timestamp_custom('%H:%M:%S', false) }}"

Screenshot of Template Editor:

Thank you for help it was the solution.

Hey!

Guys trying to add leading zero into my uptime sensor in minutes field, but I think I do something wrong and leading zero is not showing, what I need to do in my case for minutes like 01-09?

Here is my sensor:

      - name: input_meter_uptime_short
        state: >
          {% set uptime = states('sensor.corridor_input_electricity_meter_l3') | int(0) %}
          {% set minutes = ((uptime % 3600) / 60) | int(0) %}
          {% set hours = ((uptime % 86400) / 3600) | int(0) %}
          {% set days = (uptime / 86400) | int(0) %}         
          {% if days > 0 %}{{ days }}d {% endif %}{% if hours > 0 %}{{ hours }}:{% endif %}{% if minutes > 0 and uptime > 60 %}{{ minutes }}{% elif minutes > 0 and uptime < 60 %}{{ minutes | format(morph=['minute','minutes','minutes'], as_text=false) }}{% else %}<1 min.{% endif %}
        attributes:
          days: "{{ (states('sensor.corridor_input_electricity_meter_l3') | int(0) / 86400) | int(0) }}"
          hours: "{{ ((states('sensor.corridor_input_electricity_meter_l3') | int(0) % 86400) / 3600) | int(0) }}"
          minutes: "{{ ((states('sensor.corridor_input_electricity_meter_l3') | int(0) % 3600) / 60) | int(0) }}"
          raw: "{{ states('sensor.corridor_input_electricity_meter_l3') | int(0) }}"
        icon: mdi:clock-fast