php 以本地语言获取上个月的名字

问题描述 投票:0回答:1

我想得到最近一个月的本地语言名称。我试过这个方法,但得到的是一个神秘的输出。

setlocale(LC_TIME, 'de_DE.ISO8859-1');

echo date('%B', strtotime('-1 month')); // returns %475
echo date('F', strtotime('-1 month')); // returns April (= english)
php date time strtotime
1个回答
0
投票

使用 strftime 用于本地化的月份名称。

echo strftime('%B', strtotime('-1 month'));
© www.soinside.com 2019 - 2024. All rights reserved.