For a current project I need german date outputs (with day names). In 2007 @jako created a snippet with the deprecated strftime function (https://www.partout.info/blog/deutsches-datum.html).
There are longer discussions in this community about new date formatting options, for instance here: What's happening with the strftime() and date() output modifiers? - #13 by bobray
I’m not a programmer but I tried to create an output modifier for german dates. Maybe it’s helpful for others? This is the snippet code:
<?php
/*
* description: returns german date compatible to PHP 8.1 and above
* usage: [+string:date_ger=`format`+]
*/
$date = strtotime($input);
$format = (strlen($options) > 0) ? $options : 'cccc, d. MMMM YYYY';
$fmt = datefmt_create(
'de_DE',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'Europe/Berlin',
IntlDateFormatter::GREGORIAN,
$format
);
$output = datefmt_format($fmt, $date);
return $output;
And here you will find patterns to format the desired date: Formatting Dates and Times | ICU Documentation
Some examples:
- ccc., dd.MM.yy => Mo., 06.02.23
- cccc, d. MMMM YYYY => Montag, 6. Februar 2023
- cccc, d. MMMM YYYY, HH:mm => Montag, 6. Februar 2023, 15:30