How to render a DateTime object in a Twig template

One of my fields in one of my entities is a “datetime” variable. How can I convert this field into a string to render in a browser? Here is a code snippet: {% for game in games %} … <td> {{game.gameTeamIdOne.teamName}} </td> <td> {{game.gameTeamIdTwo.teamName}} </td> <td> {{game.gameDate}}</td> </tr> {% endfor %} Here is the variable … Read more

How to concatenate strings in twig

Anyone knows how to concatenate strings in twig? I want to do something like: {{ concat(‘http://’, app.request.host) }} 1Best Answer 11 This should work fine: {{ ‘http://’ ~ app.request.host }} To add a filter – like ‘trans’ – in the same tag use {{ (‘http://’ ~ app.request.host) | trans }} As Adam Elsodaney points out, … Read more