获取本地化月份的列表

获取本地化月份的列表

本文介绍了获取本地化月份的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于PHP在intl扩展中使用了来自ICU的数据,是否有办法从PHP中获取本地化的月份名称?

Since PHP uses data from ICU in the intl extension, are there ways to get localized month names from within PHP?

虽然我可以从ICU的xml文件中获取数据并将其提取到我自己的文件集中,但如果可能的话,我还是更希望使用一种干净便捷的解决方案.

While I can get the data from ICU's xml files and extract them into my own set of files, I would much prefer a clean and easier solution if possible.

最后,给定intl扩展名的区域设置,是否有办法获取日期格式(MM/DD/YYYY或DD/MM/YYYY)?

Finally, are there ways to get the date format (MM/DD/YYYY or DD/MM/YYYY), given the locale from the intl extension?

推荐答案

可以使用IntlDateFormatter::getPattern来获取模式吗?我不了解strftime,但是我会建议使用格式为MMMM的格式来获取每个月的月份名称.看起来php.intl不能直接公开数据.

Could you use IntlDateFormatter::getPattern to get the pattern? I don't know about strftime, but I would use the suggestion of formatting with a pattern MMMM to get the month name, through each month. Looks like php.intl doesn't expose the data directly.

这篇关于获取本地化月份的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 01:40