I retrieve a timefield from my MS SQL database, for example '10:30:00' (hh:mm:ss). I try to render this in a twig template, but I only want to display the '10:30' portion (hh:mm).
I've tried to get this done using both number_format and date_format, but I can't seem to get it done. For example, a failed attempt would be:
<td class="PODTIME">{{ record.PODTIME|number_format(2, ':') }}</td>
Yeah that doesn't make sense. But I can't find anything even remotely close to what I want - I guess I'm overlooking something.
Thanks
You can use the Twig filter date like this :
{{ object.date|date('H:i:s') }}
As seen on this thread : How to render a DateTime object in a Twig template
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With