[Serializable] |
The Japanese calendar recognizes one era for every emperor's reign. The current era is the Heisei era, which began in the Gregorian calendar year 1989. The era name is typically displayed before the year. For example, the Gregorian calendar year 2001 is the Japanese calendar year Heisei 13. Note that the first year of an era is called "Gannen"; therefore, the Gregorian calendar year 1989 was the Japanese calendar year Heisei Gannen.
This class assigns numbers to the eras as follows:
GetEra value | Era Name | Era Abbreviation | Gregorian Dates |
---|---|---|---|
4 | 平成 (Heisei) | 平 (H, h) | January 8, 1989 to present |
3 | 昭和 (Showa) | 昭 (S, s) | December 25, 1926 to January 7, 1989 |
2 | 大正 (Taisho) | 大 (T, t) | July 30, 1912 to December 24, 1926 |
1 | 明治 (Meiji) | 明 (M, m) | September 8, 1868 to July 29, 1912 |
This class only handles dates from the eighth day of the ninth month in the year Meiji 3 (September 8, 1868 of the Gregorian calendar). Although the Japanese calendar was switched from a lunar calendar to a solar calendar in the year Meiji 6 (1873 of the Gregorian calendar), this implementation is based on the solar calendar only.
Leap years in the Japanese calendar correspond to the same leap years in the Gregorian calendar. A leap year in the Gregorian calendar is defined as a Gregorian year that is evenly divisible by four, except if it is divisible by 100; however, Gregorian years that are divisible by 400 are leap years. A common year has 365 days and a leap year has 366 days.
The Japanese calendar has 12 months with 28 to 31 days each:
GetMonth value | Month | English | Days in common years | Days in leap years |
---|---|---|---|---|
1 | 1月 (Ichigatsu) | January | 31 | 31 |
2 | 2月 (Nigatsu) | February | 28 | 29 |
3 | 3月 (Sangatsu) | March | 31 | 31 |
4 | 4月 (Shigatsu) | April | 30 | 30 |
5 | 5月 (Gogatsu) | May | 31 | 31 |
6 | 6月 (Rokugatsu) | June | 30 | 30 |
7 | 7月 (Shichigatsu) | July | 31 | 31 |
8 | 8月 (Hachigatsu) | August | 31 | 31 |
9 | 9月 (Kugatsu) | September | 30 | 30 |
10 | 10月 (Juugatsu) | October | 31 | 31 |
11 | 11月 (Juuichigatsu) | November | 30 | 30 |
12 | 12月 (Juunigatsu) | December | 31 | 31 |
Nigatsu, which is equivalent to the Gregorian calendar month of February, has 29 days during leap years and 28 during common years.
The date January 1, 2001 A.D. in the Gregorian calendar is equivalent to the first day of Ichigatsu in the year Heisei 13 in the Japanese calendar.
If using the JapaneseCalendar class, DateTime.Parse will recognize the era abbreviations in front of the year; that is, either the single-character case-insensitive Latin alphabet abbreviation or the single-character Kanji abbreviation.
ctor #1 | Default constructor. This constructor is called by derived class constructors to initialize state in this type. Initializes a new instance of the JapaneseCalendar class. |
Eras | Read-only Overridden: Gets the list of eras in the JapaneseCalendar. |
TwoDigitYearMax | Read-write Overridden: Gets or sets the last year of a 100-year range that can be represented by a 2-digit year. |
AddDays (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddDays Returns a DateTime that is the specified number of days away from the specified DateTime. |
AddHours (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddHours Returns a DateTime that is the specified number of hours away from the specified DateTime. |
AddMilliseconds (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddMilliseconds Returns a DateTime that is the specified number of milliseconds away from the specified DateTime. |
AddMinutes (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddMinutes Returns a DateTime that is the specified number of minutes away from the specified DateTime. |
AddMonths | Overridden: Returns a DateTime that is the specified number of months away from the specified DateTime. |
AddSeconds (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddSeconds Returns a DateTime that is the specified number of seconds away from the specified DateTime. |
AddWeeks (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddWeeks Returns a DateTime that is the specified number of weeks away from the specified DateTime. |
AddYears | Overridden: Returns a DateTime that is the specified number of years away from the specified DateTime. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetDayOfMonth | Overridden: Returns the day of the month in the specified DateTime. |
GetDayOfWeek | Overridden: Returns the day of the week in the specified DateTime. |
GetDayOfYear | Overridden: Returns the day of the year in the specified DateTime. |
GetDaysInMonth (inherited from System.Globalization.Calendar) |
Overloaded:GetDaysInMonth(int year, int month) See base class member description: System.Globalization.Calendar.GetDaysInMonthReturns the number of days in the specified month in the specified year in the current era. |
GetDaysInMonth | Overloaded:GetDaysInMonth(int year, int month, int era) Overridden: Returns the number of days in the specified month in the specified year in the specified era. |
GetDaysInYear (inherited from System.Globalization.Calendar) |
Overloaded:GetDaysInYear(int year) See base class member description: System.Globalization.Calendar.GetDaysInYearReturns the number of days in the specified year in the current era. |
GetDaysInYear | Overloaded:GetDaysInYear(int year, int era) Overridden: Returns the number of days in the specified year in the specified era. |
GetEra | Overridden: Returns the era in the specified DateTime. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetHour (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.GetHour Returns the hours value in the specified DateTime. |
GetMilliseconds (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.GetMilliseconds Returns the milliseconds value in the specified DateTime. |
GetMinute (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.GetMinute Returns the minutes value in the specified DateTime. |
GetMonth | Overridden: Returns the month in the specified DateTime. |
GetMonthsInYear (inherited from System.Globalization.Calendar) |
Overloaded:GetMonthsInYear(int year) See base class member description: System.Globalization.Calendar.GetMonthsInYearReturns the number of months in the specified year in the current era. |
GetMonthsInYear | Overloaded:GetMonthsInYear(int year, int era) Overridden: Returns the number of months in the specified year in the specified era. |
GetSecond (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.GetSecond Returns the seconds value in the specified DateTime. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
GetWeekOfYear (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.GetWeekOfYear Returns the week of the year that includes the date in the specified DateTime. |
GetYear | Overridden: Returns the year in the specified DateTime. |
IsLeapDay (inherited from System.Globalization.Calendar) |
Overloaded:IsLeapDay(int year, int month, int day) See base class member description: System.Globalization.Calendar.IsLeapDayDetermines whether the specified date in the current era is a leap day. |
IsLeapDay | Overloaded:IsLeapDay(int year, int month, int day, int era) Overridden: Determines whether the specified date in the specified era is a leap day. |
IsLeapMonth (inherited from System.Globalization.Calendar) |
Overloaded:IsLeapMonth(int year, int month) See base class member description: System.Globalization.Calendar.IsLeapMonthDetermines whether the specified month in the specified year in the current era is a leap month. |
IsLeapMonth | Overloaded:IsLeapMonth(int year, int month, int era) Overridden: Determines whether the specified month in the specified year in the specified era is a leap month. |
IsLeapYear (inherited from System.Globalization.Calendar) |
Overloaded:IsLeapYear(int year) See base class member description: System.Globalization.Calendar.IsLeapYearDetermines whether the specified year in the current era is a leap year. |
IsLeapYear | Overloaded:IsLeapYear(int year, int era) Overridden: Determines whether the specified year in the specified era is a leap year. |
ToDateTime (inherited from System.Globalization.Calendar) |
Overloaded:ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond) See base class member description: System.Globalization.Calendar.ToDateTimeReturns a DateTime that is set to the specified date and time in the current era. |
ToDateTime | Overloaded:ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) Overridden: Returns a DateTime that is set to the specified date and time in the specified era. |
ToFourDigitYear | Overridden: Converts the specified two-digit year to a four-digit year by using the JapaneseCalendar.TwoDigitYearMax property to determine the appropriate century. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public JapaneseCalendar(); |
public override int[] Eras {get;}
|
This class assigns numbers to the eras as follows:
GetEra value | Era Name | Era Abbreviation | Gregorian Dates |
---|---|---|---|
4 | 平成 (Heisei) | 平 (H, h) | January 8, 1989 to present |
3 | 昭和 (Showa) | 昭 (S, s) | December 25, 1926 to January 7, 1989 |
2 | 大正 (Taisho) | 大 (T, t) | July 30, 1912 to December 24, 1926 |
1 | 明治 (Meiji) | 明 (M, m) | September 8, 1868 to July 29, 1912 |
This class only handles dates from the eighth day of the ninth month in the year Meiji 3 (September 8, 1868 of the Gregorian calendar). Although the Japanese calendar was switched from a lunar calendar to a solar calendar in the year Meiji 6 (1873 of the Gregorian calendar), this implementation is based on the solar calendar only.
public override int TwoDigitYearMax {get; set;}
|
time
days
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
time
hours
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
time
milliseconds
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
time
minutes
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
time
months
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
ArgumentOutOfRangeException | months is less than -120000. -or- months is greater than 120000. |
For example, if the specified month is Juugatsu (October), which has 31 days, the specified day is the 31st day of that month, and months is 6, the resulting year is one more than the specified year, the resulting month is Shigatsu (April), and the resulting day is the 30th day, which is the last day in Shigatsu (April).
If months is negative, the resulting DateTime is earlier than the specified DateTime.
time
seconds
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
time
weeks
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
In all .NET Framework classes derived from the Calendar class, a week is defined as seven days, except the first and last weeks of the year which might have less than seven days.
time
years
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
For example, Nigatsu (February) has 28 days, except during leap years when it has 29 days. If the specified date is the 29th day of Nigatsu (February) in a leap year and the value of years is 1, the resulting date will be the 28th day of Nigatsu (February) in the following year.
If years is negative, the resulting DateTime is earlier than the specified DateTime.
~JapaneseCalendar(); |
time
time
DayOfWeek value | which indicates |
---|---|
Sunday | 日曜日 (Nichiyoubi) |
Monday | 月曜日 (Getsuyoubi) |
Tuesday | 火曜日 (Kayoubi) |
Wednesday | 水曜日 (Suiyoubi) |
Thursday | 木曜日 (Mokuyoubi) |
Friday | 金曜日 (Kinyoubi) |
Saturday | 土曜日 (Doyoubi) |
time
year
month
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- month is outside the range supported by the calendar. |
year
month
era
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- month is outside the range supported by the calendar. -or- era is outside the range supported by the calendar. |
year
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. |
year
era
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- era is outside the range supported by the calendar. |
time
This class assigns numbers to the eras as follows:
GetEra value | Era Name | Era Abbreviation | Gregorian Dates |
---|---|---|---|
4 | 平成 (Heisei) | 平 (H, h) | January 8, 1989 to present |
3 | 昭和 (Showa) | 昭 (S, s) | December 25, 1926 to January 7, 1989 |
2 | 大正 (Taisho) | 大 (T, t) | July 30, 1912 to December 24, 1926 |
1 | 明治 (Meiji) | 明 (M, m) | September 8, 1868 to July 29, 1912 |
This class only handles dates from the eighth day of the ninth month in the year Meiji 3 (September 8, 1868 of the Gregorian calendar). Although the Japanese calendar was switched from a lunar calendar to a solar calendar in the year Meiji 6 (1873 of the Gregorian calendar), this implementation is based on the solar calendar only.
public virtual int GetHashCode(); |
time
time
time
time
year
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. |
year
era
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- era is outside the range supported by the calendar. |
time
public Type GetType(); |
public virtual int GetWeekOfYear( |
time
rule
firstDayOfWeek
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | firstDayOfWeek is outside the range supported by the calendar. -or- rule is not a valid CalendarWeekRule value. |
DateTimeFormatInfo.CalendarWeekRule of CultureInfo.DateTimeFormat contains the default CalendarWeekRule value that defines a calendar week for a specific culture.
This method can also be used to determine the number of weeks in the year by setting time to the last day of the year.
time
year
month
day
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- month is outside the range supported by the calendar. -or- day is outside the range supported by the calendar. |
A leap day is a day that occurs only in a leap year. For example, in the Gregorian calendar, the 29th day of February is the only leap day.
year
month
day
era
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- month is outside the range supported by the calendar. -or- day is outside the range supported by the calendar. -or- era is outside the range supported by the calendar. |
A leap day is a day that occurs only in a leap year. For example, the 29th day of Nigatsu (February) is the only leap day.
year
month
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- month is outside the range supported by the calendar. |
A leap month is an entire month that occurs only in a leap year. For example, in the Hebrew calendar, Veadar is the only leap month.
year
month
era
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- month is outside the range supported by the calendar. -or- era is outside the range supported by the calendar. |
A leap month is an entire month that occurs only in a leap year. The Japanese calendar does not have any leap months.
year
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. |
year
era
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- era is outside the range supported by the calendar. |
protected object MemberwiseClone(); |
public virtual DateTime ToDateTime( |
year
month
day
hour
minute
second
millisecond
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- month is outside the range supported by the calendar. -or- day is outside the range supported by the calendar. -or- hour is less than zero or greater than 23. -or- minute is less than zero or greater than 59. -or- second is less than zero or greater than 59. -or- millisecond is less than zero or greater than 999. |
public override DateTime ToDateTime( |
year
month
day
hour
minute
second
millisecond
era
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- month is outside the range supported by the calendar. -or- day is outside the range supported by the calendar. -or- hour is less than zero or greater than 23. -or- minute is less than zero or greater than 59. -or- second is less than zero or greater than 59. -or- millisecond is less than zero or greater than 999. -or- era is outside the range supported by the calendar. |
year
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. |
Because the year in the Japanese calendar is typically less than four digits long, this implementation always returns the value of the year parameter.
public virtual string ToString(); |