Skip to main content

{{date}} is a formatting helper for outputting dates in various formats. You can either pass it a date and a format string to be used to output the date like so:
See the Moment.js Display tokens for more options. Timezone and locale may be overridden from your site’s defaults by passing the timezone and locale parameters:
Or you can pass it a date and the timeago flag:
If you use the timeago flag on a site that uses caching - as on Ghost(Pro) - dates will be displayed relative to when the page gets cached rather than relative to the visitor’s current time. If you call {{date}} without a format, it will default to a short localised format, ll. If you call {{date}} without telling it which date to display, it will default to one of two things:
  1. If there is a published_at property available (i.e. you’re inside a post object) it will use that
  2. Otherwise, it will default to the current date
date uses moment.js for formatting dates. See their documentation for a full explanation of all the different format strings that can be used.

Example Code