laravel carbon formatLocalized() 生成三字母月份日期格式
laravel carbon formatLocalized() generate three letter month date format
我正在使用 carbon 和 laravel 5.5 并希望将日期格式化为仅以三个字母格式显示月份
(ie:
January => Jan,
February => Feb,
...)
我使用了 'M' 格式,但它不起作用。这是我的代码:
Carbon\Carbon::parse("2018-03-20")->formatLocalized('%M').
它returns
"00".
有什么想法吗?
Carbon 的 formatLocalized('%d %B %Y')
returns 3 个字母的月份名称的整个月份字符串使用它是这样的:
echo Carbon::parse("2018-03-20")->formatLocalized('%d %b %Y');
OUTPUT
20 Mar 2018
阅读更多关于 Localization
我正在使用 carbon 和 laravel 5.5 并希望将日期格式化为仅以三个字母格式显示月份
(ie:
January => Jan,
February => Feb,
...)
我使用了 'M' 格式,但它不起作用。这是我的代码:
Carbon\Carbon::parse("2018-03-20")->formatLocalized('%M').
它returns
"00".
有什么想法吗?
Carbon 的 formatLocalized('%d %B %Y')
returns 3 个字母的月份名称的整个月份字符串使用它是这样的:
echo Carbon::parse("2018-03-20")->formatLocalized('%d %b %Y');
OUTPUT 20 Mar 2018
阅读更多关于 Localization