PHP locale de_DE is returning English locale

前端 未结 1 742
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-25 08:53

I am using Apache and php 7 on an Ubuntu System. After installing the german locales and running locale -a to check the installed locales, I get C, C.UTF-8, d

相关标签:
1条回答
  • 2021-01-25 09:04

    The date() function doesn't listen to the locales - this will be returning values in English only.

    From the date() documentation,

    To format dates in other languages, you should use the setlocale() and strftime() functions instead of date().

    You need to use strftime() instead.

    setlocale(LC_ALL,'de_DE');
    echo strftime("%B", strtotime("2018-10-10"));
    
    • strftime() documentation
    0 讨论(0)
提交回复
热议问题