2 回答
TA贡献1803条经验 获得超6个赞
是的,您可以结合使用 setlocale 和 strftime。
<?php
$result = setlocale(LC_ALL, 'sr'); //set locale to cyrillic
// handle your error here, if $result is false, it means the locale is not supported by your system
$month_name = strftime("%B");
您可以查看https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/39cwe7zf(v=vs.90)以了解要设置的不同语言。
TA贡献1856条经验 获得超11个赞
您可以使用 IntlDateFormatter:
$dateTime = new DateTime('2019-08-25', new DateTimezone('Europe/Moscow'));
$fmt = datefmt_create(
'ru_RU',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'Europe/Moscow',
IntlDateFormatter::GREGORIAN
);
datefmt_set_pattern($fmt, 'LLLL');
echo 'месяц: ' . datefmt_format($fmt, $dateTime);
输出:月份:八月
- 2 回答
- 0 关注
- 172 浏览
添加回答
举报