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 關注
- 195 瀏覽
添加回答
舉報