date Filter

Converts a timestamp into another date and/or time format.

Parameters

Parameter Required Description
format Yes string Format to convert to. The syntax for this is the same as strftime.

Category

String Filters

Description

The date filter formats a date object into a formatted date and/or time of your choice. See strftime.org for a full list of formatting options.

You can also pass the now date object to this function to get the current date and time.

Examples

{{ published_at | date: '%a, %b %d, %y' }}

Example Output

Fri, Jul 17, 16
{{ published_at | date: '%Y' }}

Example Output

2016
Copyright © {{ now | date: '%Y' }} Innitech. All rights reserved.

Example Output

Copyright © 2018 Initech. All rights reserved.

Related