0

Hi I am trying to display months name in PHP but it is not showing in German language in MYSQL, my date is showing as 2021-01-23 which I converted into months by using PHP function Month(), MONTH(beginn)

PHP Code -

date_default_timezone_set('Europe/Berlin');
setlocale(LC_ALL, 'de_DE.utf8');
echo  (date("F",strtotime($month)));
  • try the second and third answers here: https://stackoverflow.com/questions/13845554/php-date-get-name-of-the-months-in-local-language – chaqke May 04 '21 at 23:58

1 Answers1

1

Try this

date_default_timezone_set('Europe/Berlin');
$loc=setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'deu_deu');
echo utf8_encode(strftime("%B",strtotime("2021-06-23")));

Convert June to Juni

Edit: some characters in German are utf8 enncoded utf8_encode function solve it. Like März

Artier
  • 1,648
  • 2
  • 8
  • 22