Reputation: 69
In the database, I have following date: 1924-01-17
, as a date-type, but when I render it as {{ person.BirthDate | date("d/m/Y") }}
, it gives as a result 17/01/2024
.
How can I solve the Year-problem?
Upvotes: 1
Views: 297
Reputation: 53462
Twig documentation for date says:
The date filter accepts strings (it must be in a format supported by the strtotime function), DateTime instances, or DateInterval instances.
DateTime instance should do the trick, and based on comments it fixed this.
Upvotes: 2