System.Globalization 中的柬埔寨日期时间格式错误?

发布于 2024-12-18 08:40:49 字数 549 浏览 2 评论 0原文

在柬埔寨语中,区域设置为 kh-KH,日期时间格式为 dd/MM/yyyy。但.NET Framework 全球化使用km-KH,显示的日期时间格式为yyyy-MM-dd

var ci = new CultureInfo("km-kh");
Console.WriteLine(DateTime.Now.ToString(ci)); 
//Will display in yyyy-MM-dd format

毫不奇怪,Windows 本身使用相同的日期时间格式 (yyyy-MM-dd),这不是柬埔寨人使用的格式。当我搜索“kh-KH”时,没有匹配结果,大多数都是“km-KH”,似乎“km-KH”是国际标准,但为什么大型软件供应商会实施错误的日期时间它的格式?

我真的很困惑,谁是对的,谁是错的?我倾向于相信柬埔寨人自己是正确的,但为什么微软会犯这种“错误”呢?或者我只是在某些方面犯了错误?

如果有人能在这里解决我的困惑,我将不胜感激。多谢!

In Cambodian, the locale is kh-KH, datetime format is dd/MM/yyyy. But the .NET Framework globalization is using km-KH and the datetime format displayed is yyyy-MM-dd.

var ci = new CultureInfo("km-kh");
Console.WriteLine(DateTime.Now.ToString(ci)); 
//Will display in yyyy-MM-dd format

Not surprisingly, Windows itself is using the same datetime format (yyyy-MM-dd) which is not what Cambodians are using. When I googled "kh-KH", there is no matching result of it, most of them are "km-KH", it seems like "km-KH" is the international standard but why the giant software vendor would implement a wrong datetime format of it?

I am seriously confused, who is right, who is wrong? I tend to believe the cambodian themselves are correct but why Microsoft made this kind of "mistake"? Or am I just making mistakes in some way?

I would appreciate if anyone can solve my confusions here. Thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不忘初心 2024-12-25 08:40:49

我认为我们在柬埔寨主要使用的日期时间格式:dd-mm-yyyy 或 dd/mm/yyyy。

但我在你提到的帖子中看到一个错误,这是本地的:“kh-KH”错误,是“km-KH”。

请查看:http:// /osify.com/2012/11/cambodia-technical-identifier-code-to-be-aware/#.UNK72azp574

I think date time format mostly we are using: dd-mm-yyyy or dd/mm/yyyy in Cambodia.

But I saw a mistake in the post you mention, it's the local: "kh-KH" is wrong, it's "km-KH".

Please have a look at: http://osify.com/2012/11/cambodia-technical-identifier-code-to-be-aware/#.UNK72azp574

柒七 2024-12-25 08:40:49

Windows 和 .NET 中的区域设置都是 km-KH,而不是 kh-KH;我怀疑错误的结果与此有某种关系。

无论是谁创建了 kh-KH,都应该检查 CultureInfo.Name 以查看实际创建的内容。我怀疑一些错误的后备逻辑最终是造成这种情况的原因。

The locale in both Windows and .NET is km-KH, not kh-KH; I suspect the incorrect results are related to this somehow.

Whoever is creating kh-KH should check CultureInfo.Name to see what was actually created. I suspect some errant fallback logic is ultimately responsible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文