Formatting how date/time is displayed in Drupal 8/9
Andrew Fletcher published: 26 July 2021 2 minutes read
You can create a new date/time format by navigating to:
Admin -> Configuration -> Regional and Language -> Date and Time format and click on 'Add Format'.
Once you’ve created date format, you can control the way date is displayed on the node using preprocess function.
In {theme_name}.theme file, add the following lines