Skip to main content
1 of 2
Platon
  • 331
  • 2
  • 5
  • 13

How to print date in format «long» on node.html.twig template?

Try this code (at node.html.twig, Drupal 8.0.0-rc3):

{% set date = node.created|format_date('long') %}

And next:

{{ dump(date) }}

Return error:

Exception: The timestamp must be numeric. in Drupal\Component\Datetime\DateTimePlus::createFromTimestamp() (line 165 of core/lib/Drupal/Component/Datetime/DateTimePlus.php).

Drupal\Core\Datetime\DateFormatter->format(Object, 'long')
Platon
  • 331
  • 2
  • 5
  • 13