Date format in Print Format HTML

I’m trying to format the date in the last column of my table. I’ve seen a number of suggestions on the forum regarding the use of: frappe.utils.formatdate() and doc.get_formatted('fieldname'), however neither have worked for me.

Any suggestions on getting {{ lease_ack.date }} in the format: DD/MM/YYYY would be very much appreciated.

Cheers!

{% if doc.lease_type!="Classic" %}
 <table class = "table table-sm">
    <thead>
        <tr>
            <th scope="col">Name</th>
            <th scope="col">Signature</th>
            <th scope="col">Date</th>
        </tr>
    </thead>
    
{% for lease_ack in doc.lease_ack %}
{% if lease_ack.date %}
    <tbody>
        <tr>
            <!--<th scope="row">{{ loop.index }}</th>-->
            <td class="align-middle">{{ lease_ack.customer_name }}</td>
            <td class="align-middle"><img src= {{ lease_ack.customer_signature }} height="50px" width="100px"></td>
            <td class="align-middle">{{ lease_ack.date }}</td>
        </tr>
    </tbody>
{% endif %}
{% endfor %}
 </table>

@Shaun

{{frappe.utils.getdate(lease_ack.date).strftime("%d/%m/%Y") }}

or

{{frappe.utils.getdate(lease_ack.date).strftime("%d/%m/%Y") }}
1 Like

try get_formatted function:

{{doc.get_formatted(“lease_ack”}}

or doc.get_formatted(“lease_ack”, doc)

This one worked! Thanks so much mate :raised_hands: