【发布时间】:2020-09-11 23:28:47
【问题描述】:
我想用当地语言获取上个月的名称。我试过这个,但我得到一个神秘的输出:
setlocale(LC_TIME, 'de_DE.ISO8859-1');
echo date('%B', strtotime('-1 month')); // returns %475
echo date('F', strtotime('-1 month')); // returns April (= english)
【问题讨论】:
我想用当地语言获取上个月的名称。我试过这个,但我得到一个神秘的输出:
setlocale(LC_TIME, 'de_DE.ISO8859-1');
echo date('%B', strtotime('-1 month')); // returns %475
echo date('F', strtotime('-1 month')); // returns April (= english)
【问题讨论】:
使用strftime 作为本地化月份名称:
echo strftime('%B', strtotime('-1 month'));
【讨论】:
M?rz 为März。我该如何解决这个问题?