format
Format formats a time.
Format formats a time.Time value using a date format string. Strings are passed through unchanged.
Input
string time.Time
Parameters
| # | Type | Required |
|---|---|---|
| 0 | string | no |
Returns
string
Examples
Render a date in ISO form
Input
created_at = 2024-03-14T09:30:00ZTemplate
{{ created_at | format:'YYYY-MM-DD' }}Output
2024-03-14Render a date and time for display
Input
published = 2024-03-14T09:30:00ZTemplate
{{ published | format:'DD/MM/YYYY HH:mm' }}Output
14/03/2024 09:30How is this guide?