Skip to content
Advertisement

PHP setlocale has no effect

The setlocale() function doesn’t set the desired language (German).


The goal is to output month names.

This is my test code with trials so far:

JavaScript

Output:

June

instead of

Juni

Any suggestions?

  • I don’t have ssh or other shell access.
  • The script is running on a linux server.

PHP version 5.6

Advertisement

Answer

This solution might help if you don’t have shell access to the server.

If you have shell access, then Benjamin Seiller’s answer is the best!

As I don’t have any other possibilities (shell), I’ve found a solution with only PHP by using the IntlDateFormatter class.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement