date
Renders a date/time value using a PHP-style date layout (Y is the 4-digit year, m the zero-padded month, d the day, H:i:s the time, and so on).
Any character with no mapping is emitted literally.
The value has to be a date. A string is rejected rather than passed through, because a modifier named for dates that quietly returns whatever it was handed hides the field that never became one.
time.Timestringstringtime.Timeno argumentsstringRenders a time.Time using a PHP-style date layout, where Y is the 4-digit year, m the zero-padded month, and d the day.
Given
{"at": moment}Template
{{ at | date:'Y-m-d' }}Result
2024-03-14Renders a time.Time with named day and month parts, where l is the full weekday, F the full month, and j the day without a leading zero.
Given
{"at": moment}Template
{{ at | date:'l, F j, Y' }}Result
Thursday, March 14, 2024Renders just the hour and minute, where H is the zero-padded 24-hour hour and i the zero-padded minute.
Given
{"at": moment}Template
{{ at | date:'H:i' }}Result
09:30Renders a time.Time with the default "Y-m-d H:i:s" layout, the clause reached when no layout is given.
Given
{"at": moment}Template
{{ at | date }}Result
2024-03-14 09:30:05