根据PHP中的区域设置获取日期格式

根据PHP中的区域设置获取日期格式

问题描述:

有一个非常简单的问题。我有一个区域设置标识符en,en_US,cs_CZ或其他。我只需要获取该区域设置的日期时间格式。我知道我可以根据语言环境轻松地格式化任何时间戳记或日期对象。但是,我只需要日期格式的字符串表示,我们假设一个正则表达式。是否有管理此功能的功能?我没有找到任何目标...

There is a very simple problem. I have a locale identifier, en, en_US, cs_CZ or whatever. I just need to get the date-time format for that locale. I know I can easily format any timestamp or date object according to the locale. But I need just the string representation of the date format, let's say a regular expression. Is there any function managing this functionality? I haven't found any so far...

Exapmle:

$locale = "en_US";
$format = the_function_i_need($locale);
echo $format; // prints something like "month/day/year, hour:minute"


从注释转换:

您将必须构建一个包含可能性列表的数组。

you will have to build an array with a list of the possibilities.

http://en.wikipedia.org/维基/ Date_format_by_country 应该有帮助。

在完成后将功能发布到某个地方,我相信它会派上用场的人。

post the function somewhere when done, i'm sure it would come in handy for others