日期的格式是否取决于用户的区域设置和日历系统? [英] Does the formatting of a date depend on both the user's locale and calendar system?

查看:143
本文介绍了日期的格式是否取决于用户的区域设置和日历系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得这个问题对所有语言的所有程序员来说都很通用。
这有点模糊。首先,有语言环境,它封装了文化信息和其他东西。我相信这些语言环境对象还封装了有关日期和时间格式的信息,即如何在Unicode标准中显示日期。像这样,例如:yyyy-MM-dd'T'HH:mm:ssZ。每个国家/地区都可能拥有自己的日期+时间格式规则,因此我们对地区设置感到高兴,我们的应用的用户可以将日期+时间格式化为其所在地区的通常格式。

I feel this question is very general for all programmers on all languages. This is somewhat blurry. First, there are locales, which encapsulate cultural information and other stuff. I believe these locale objects also encapsulate information about date and time formatting, i.e. how to display a date, in Unicode Standard. Like so, for example: "yyyy-MM-dd'T'HH:mm:ssZ". Every country may have it's own date+time formatting rules, so we are all happy about locales, and users of our apps get date+time formatted to what is usual in their region.

但现在,真的很丑的部分。有日历。不同的日历。格雷戈里亚人喜欢在美国和欧洲等一些国家,但也有希伯来语,犹太和穆斯林日历和更多。现在,这些日历当然不同。他们将一年的时间段分成不同长度的单位,一些可能有13个月,其他可能只有月相,而不是星期一,星期二,星期三等。我真的不知道,但我知道有些人对习惯于公历的人来说看起来很奇怪。

But now, the really ugly part. There are calendars. Different calendars. The Gregorian like in the US and Europe and some other countries, but there are also Hebrew, Jewish and Muslim calendars and many more. Now, these calendars are of course different. They devide the time period of a year into units of different length, some may have 13 months, other may have just moon phases instead of Monday, Tuesday, Wednesday, and so on. I don't really know, but I know some of them appear very strange to someone who is used to the Gregorian calendar.

但现在的模糊的事情:谁影响日期+时间格式化真的吗?现场?日历系统?都?并且区域设置告诉什么日历系统使用,通常?日历系统如何影响区域设置并反转?

But the blurry thing now: Who does affect date+time formatting really? The locale? The calendar system? Both? And does the locale tell what calendar system to use, usually? How does the calendar system affect the locale and reverse?

我现在几乎整天都在搜索这个主题,看起来很难像一个巨大的砖。 / p>

I've been searching now almost the whole day on this topic, and it seems hard like a huge brick.

推荐答案

在典型的操作系统中,日期例程将按照国际公约使用公历。

In a typical OS there will be date routines using the Gregorian calendar by international convention.

区域设置将决定如何格式化日期信息以及使用哪种语言。

The locale will decide how date information is to be formatted, and which language.

停止使用独立于OS日期功能的其他日历系统,但国际商务要求我们同意一个共同的日历?

This doesn't stop the use of other calendar systems independently of the OS date functions, but doesn't international commerce require that we agree on a common calendar?

这篇关于日期的格式是否取决于用户的区域设置和日历系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆