How to print field stored as time in HH:MM AM/PM format in template

I have a field say start_time stored as time in the doctype field.

I would like to print the start_time in HH:MM AM/PM format eg. 0:23:00 as 11:00 PM
{{ frappe.format(start_time,{'fieldtype': 'Time'}) }} is not really helpful. strftime also does not seem to work

This is currently not possible on frappe unfortunately.

Any update on this problem?

you can format it like this

{% set raw_time = doc.start_time %}
{% if ":" in raw_time %}
    {% set hour = raw_time.split(":")[0]|int %}
    {% set minute = raw_time.split(":")[1] %}
    <div>{{ hour % 12 or 12 }}:{{ minute }} {% if hour >= 12 %}PM{% else %}AM{% endif %}</div>
{% endif %}
1 Like

try this
{{ frappe.utils.get_time(start_time).strftime(ā€˜%I:%M %pā€™) if start_time else ā€˜ā€™ }}

1 Like

This worked for me. Thank you