JapaneseCalendar 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示日本历。
public ref class JapaneseCalendar : System::Globalization::Calendar
public class JapaneseCalendar : System.Globalization.Calendar
[System.Serializable]
public class JapaneseCalendar : System.Globalization.Calendar
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class JapaneseCalendar : System.Globalization.Calendar
type JapaneseCalendar = class
inherit Calendar
[<System.Serializable>]
type JapaneseCalendar = class
inherit Calendar
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type JapaneseCalendar = class
inherit Calendar
Public Class JapaneseCalendar
Inherits Calendar
- 继承
- 属性
注解
日本日历(也称为 Wareki 日历)的工作方式与公历完全相同,只是年份和时代不同。
注意
有关在 .NET 中使用 JapaneseCalendar 类和其他日历类的信息,请参阅 使用日历。
日本历法承认每个天皇统治的一个时代。 最近的两个时代是平成纪元,从公历1989年开始,以及从公历2019年开始的 Reiwa 时代。 纪元名称通常在年份前显示。 例如,公历 2001 年是日本历年平成 13。 请注意,一个时代的第一年被称为“甘宁”。因此,公历1989年是日本历年平成甘宁。 默认情况下,具有指定日期和时间格式字符串(如“D”、“F”和“Y”)的格式设置操作输出结果字符串中的 Gannen,而不是结果字符串中的“1”。
重要
日本历法中的年号是根据天皇统治来命名的,因此预计会发生变化。 例如,2019 年 5 月 1 日在 JapaneseCalendar 和 JapaneseLunisolarCalendar 中标志着令和年号的开始。 这种年号的变化会影响使用这些日历的所有应用程序。 有关详细信息并确定应用程序是否受到影响,请参阅 在 .NET 中处理日语日历中的新纪元。 有关在 Windows 系统上测试应用程序以确保其为时代更改做好准备的信息,请参阅 为日本时代更改准备应用程序。 有关 .NET 中支持具有多个纪元的日历的功能以及使用支持多个纪元的日历时的最佳做法,请参阅 使用纪元。
此类将数字分配给纪元,如下所示:
GetEra 值 | 纪元名称 | 时代缩写 | 公历日期 |
---|---|---|---|
5 | 令和 (reiwa) | 令和 (R, r) | 2019 年 5 月 1 日至今 |
4 | 平成 (平成) | 平 (H、h) | 1989 年 1 月 8 日至 2019 年 4 月 30 日 |
3 | 昭和 (昭和) | 昭 (S) | 1926 年 12 月 25 日至 1989 年 1 月 7 日 |
2 | 大正 (大正) | 大 (T,t) | 1912 年 7 月 30 日至 1926 年 12 月 24 日 |
1 | (Meiji) | 明 (M、m) | 1868 年 9 月 8 日至 1912 年 7 月 29 日 |
此类处理从 1868 年 9 月 8 日(1868 年 9 月 8 日)到公历 1868 年 9 月 8 日) (的日期。 虽然日本历法在公历) 年(Meiji 6 (1873 年)从农历切换到了阳历,但这种实现仅基于太阳历。
日本历中的闰年对应于公历中的同一闰年。 公历中的闰年定义为公历的公历年,除可被 100 整除外,公历年可被 4 均匀地整除。 然而,被400整除的公历年是闰年。 普通年份有 365 天,闰年有 366 天。
日本日历有 12 个月,每个日历有 28 到 31 天:
GetMonth 值 | Month | 英语 | 普通年份的天数 | 闰年中的天数 |
---|---|---|---|---|
1 | 1月 (Ichigatsu) | 1 月 | 31 | 31 |
2 | 2月 (日松) | February | 28 | 29 |
3 | 3月 (桑加松) | 3 月 | 31 | 31 |
4 | 4月 (志加松) | April | 30 | 30 |
5 | 5月 (戈加松) | 五月 | 31 | 31 |
6 | 6月 (六月) | June | 30 | 30 |
7 | 7月 (石松) | 7 月 | 31 | 31 |
8 | 8月 (八月) | 8 月 | 31 | 31 |
9 | 9月 (久松) | 9 月 | 30 | 30 |
10 | 10月 (Juugatsu) | 10 月 | 31 | 31 |
11 | 11月 (朱一加松) | 11 月 | 30 | 30 |
12 | 12月 (朱尼加松) | 12 月 | 31 | 31 |
Nigatsu 相当于公历 2 月,闰年有 29 天,平年有 28 天。
公历中2001年1月1日的日期相当于日本历法中平成13年的第一天。
JapaneseCalendar如果 是日本文化的当前日历,DateTime.Parse则 识别年份前的纪元缩写。 缩写是单字符不区分大小写的拉丁字母缩写或单字符汉字缩写。 DateTime.Parse 还确认“1”或甘宁 (元年) 为纪元年的第一年。
每个 CultureInfo 对象都支持一组日历。 属性 Calendar 返回区域性的默认日历,属性 OptionalCalendars 返回包含区域性支持的所有日历的数组。 若要更改 使用的 CultureInfo日历,请将 DateTimeFormatInfo.Calendar 属性设置为新的 Calendar。
构造函数
JapaneseCalendar() |
初始化 JapaneseCalendar 类的新实例。 |
字段
CurrentEra |
表示当前日历的当前纪元。 字段的值为 0。 (继承自 Calendar) |
属性
AlgorithmType |
获取一个值,该值指示当前日历是阳历、阴历还是二者的组合。 |
AlgorithmType |
获取一个值,该值指示当前日历是阳历、阴历还是二者的组合。 (继承自 Calendar) |
DaysInYearBeforeMinSupportedYear |
获取 MinSupportedDateTime 属性指定的年份之前的年中天数。 (继承自 Calendar) |
Eras |
获取 JapaneseCalendar 中的纪元列表。 |
IsReadOnly |
获取一个值,该值指示此 Calendar 对象是否为只读。 (继承自 Calendar) |
MaxSupportedDateTime |
获取当前 JapaneseCalendar 对象支持的最晚日期和时间。 |
MaxSupportedDateTime |
获取此 Calendar 对象支持的最晚日期和时间。 (继承自 Calendar) |
MinSupportedDateTime |
获取当前 JapaneseCalendar 对象支持的最早日期和时间。 |
MinSupportedDateTime |
获取此 Calendar 对象支持的最早日期和时间。 (继承自 Calendar) |
TwoDigitYearMax |
获取或设置可以用两位数年份表示的 100 年范围内的最后一年。 |