date
Converts a timestamp into another date format.
Output formats can be referenced from the Ruby documentation.
Parameters
time{String}: The timestamp. This parameter is required.format{String}: The date format. This parameter is optional.hash.format{String}: The date format. This parameter is optional.returns{String}: The formatted date string.
Usage
{{date string string}}
Example
{{ date article.created_at '%B %d, %Y' }}
Current Date
The date helper can be applied to the keywords 'today' and 'now' to output the current timestamp.
Note
The timestamp corresponds to the time of the most recent Handlebars rendering. Consequently, it may not refresh with every page view due to context and caching considerations.
{{ date 'now' '%B %d, %Y' }}
Format
{{date string string}}
{{date string format=string}}
Specify the date format recognizable by the locale. You can use the following formats:
abbreviated_datebasicdatedate_at_timedefaulton_date
{{ date article.created_at 'abbreviated_date' }}
Was this article helpful to you?