How do I format time to hh:mm using Twig (Symfony)

前端 未结 1 2212
刺人心
刺人心 2021-02-20 05:01

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 (h

1条回答
  •  梦谈多话
    2021-02-20 05:28

    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

    0 讨论(0)
提交回复
热议问题