Jul 18, 2019 in Drupal 8, Snippets

Twig comes with quite some handy functionalities. Date formatting is an example. In this snippet an example of how to show the created date in a drupal 8 time format. 

{% set date = node.created.value|date('U')|format_date('short') %}
{{ date }}

You could also do just the following:

{% set date = node.created.value %}
{{ date|date('M d') }}