German spelling of months

The date of a blog entry I give
With

<? = $ Page-> date ('d. F Y')?>

I’ll get the date of a blog post in the german format DD. Month YYYY.
How do I get the German spelling of the months?

I used http://php.net/manual/de/intldateformatter.format.php for this.

  • First, set the locale to German in your config settings.
  • Second, set date.handler to strftime.
  • Last, use a strftime format instead of d. F Y

Also see this post: Textual representation of dates in multilang setup

I use this code in my template(s):

<?php setlocale(LC_TIME, "de_DE.utf8"); snippet('header') ?>
...
<?= strftime( "%d. %B %Y", strtotime(date("Y-m-d", $page->date())) ) ?>

This gives me:

Auswahl_103

1 Like