System.Globalization.JapaneseCalendar Class

Assembly: Mscorlib.dll
Namespace: System.Globalization
Summary
Represents the Japanese calendar.
C# Syntax:
[Serializable]
public class JapaneseCalendar : Calendar
Remarks
The Japanese calendar, which is also known as the Wareki calendar, works exactly like the Gregorian calendar, except that the year and era are different.

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.

See also:
System.Globalization Namespace | Calendar | GregorianCalendar

System.Globalization.JapaneseCalendar Member List:

Public Constructors
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.
Public Properties
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.
Public Methods
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.GetDaysInMonth


Returns 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.GetDaysInYear


Returns 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.GetMonthsInYear


Returns 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.IsLeapDay


Determines 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.IsLeapMonth


Determines 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.IsLeapYear


Determines 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.ToDateTime


Returns 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.
Protected Methods
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:


System.Globalization.JapaneseCalendar Member Details

ctor #1
Summary
Initializes a new instance of the JapaneseCalendar class.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public JapaneseCalendar();

Return to top


Overridden Property: Eras (read-only)
Summary
Gets the list of eras in the JapaneseCalendar.
C# Syntax:
public override int[] Eras {get;}
Remarks
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.

Return to top


Overridden Property: TwoDigitYearMax (read-write)
Summary
Gets or sets the last year of a 100-year range that can be represented by a 2-digit year.
C# Syntax:
public override int TwoDigitYearMax {get; set;}
Remarks
This property implements Calendar.TwoDigitYearMax.
See also:
JapaneseCalendar.ToFourDigitYear

Return to top


Method: AddDays(
   DateTime time,
   int days
)
Inherited
See base class member description: System.Globalization.Calendar.AddDays

Summary
Returns a DateTime that is the specified number of days away from the specified DateTime.
C# Syntax:
public virtual DateTime AddDays(
   DateTime time,
   int days
);
Parameters:

time

The DateTime to which to add days.

days

The number of days to add.

Return Value:
The DateTime that results from adding the specified number of days to the specified DateTime.
Exceptions
Exception Type Condition
ArgumentException The resulting DateTime is outside the supported range.
Remarks
The days value is rounded to the nearest millisecond before it is added to the specified DateTime. If days is negative, the resulting DateTime is earlier than the specified DateTime.
See also:
DateTime | Calendar.AddYears | Calendar.AddMonths | Calendar.AddWeeks | Calendar.AddHours | Calendar.AddMinutes | Calendar.AddSeconds | Calendar.AddMilliseconds

Return to top


Method: AddHours(
   DateTime time,
   int hours
)
Inherited
See base class member description: System.Globalization.Calendar.AddHours

Summary
Returns a DateTime that is the specified number of hours away from the specified DateTime.
C# Syntax:
public virtual DateTime AddHours(
   DateTime time,
   int hours
);
Parameters:

time

The DateTime to which to add hours.

hours

The number of hours to add.

Return Value:
The DateTime that results from adding the specified number of hours to the specified DateTime.
Exceptions
Exception Type Condition
ArgumentException The resulting DateTime is outside the supported range.
Remarks
The hours value is rounded to the nearest millisecond before it is added to the specified DateTime. If hours is negative, the resulting DateTime is earlier than the specified DateTime.
See also:
DateTime | Calendar.AddYears | Calendar.AddMonths | Calendar.AddWeeks | Calendar.AddDays | Calendar.AddMinutes | Calendar.AddSeconds | Calendar.AddMilliseconds

Return to top


Method: AddMilliseconds(
   DateTime time,
   double milliseconds
)
Inherited
See base class member description: System.Globalization.Calendar.AddMilliseconds

Summary
Returns a DateTime that is the specified number of milliseconds away from the specified DateTime.
C# Syntax:
public virtual DateTime AddMilliseconds(
   DateTime time,
   double milliseconds
);
Parameters:

time

The DateTime to which to add milliseconds.

milliseconds

The number of milliseconds to add.

Return Value:
The DateTime that results from adding the specified number of milliseconds to the specified DateTime.
Exceptions
Exception Type Condition
ArgumentException The resulting DateTime is outside the supported range.
Remarks
The milliseconds value is rounded to the nearest integer before it is added to the specified DateTime. If milliseconds is negative, the resulting DateTime is earlier than the specified DateTime.
See also:
DateTime | Calendar.AddYears | Calendar.AddMonths | Calendar.AddWeeks | Calendar.AddDays | Calendar.AddHours | Calendar.AddMinutes | Calendar.AddSeconds

Return to top


Method: AddMinutes(
   DateTime time,
   int minutes
)
Inherited
See base class member description: System.Globalization.Calendar.AddMinutes

Summary
Returns a DateTime that is the specified number of minutes away from the specified DateTime.
C# Syntax:
public virtual DateTime AddMinutes(
   DateTime time,
   int minutes
);
Parameters:

time

The DateTime to which to add minutes.

minutes

The number of minutes to add.

Return Value:
The DateTime that results from adding the specified number of minutes to the specified DateTime.
Exceptions
Exception Type Condition
ArgumentException The resulting DateTime is outside the supported range.
Remarks
The minutes value is rounded to the nearest millisecond before it is added to the specified DateTime. If minutes is negative, the resulting DateTime is earlier than the specified DateTime.
See also:
DateTime | Calendar.AddYears | Calendar.AddMonths | Calendar.AddWeeks | Calendar.AddDays | Calendar.AddHours | Calendar.AddSeconds | Calendar.AddMilliseconds

Return to top


Overridden Method: AddMonths(
   DateTime time,
   int months
)
Summary
Returns a DateTime that is the specified number of months away from the specified DateTime.
C# Syntax:
public override DateTime AddMonths(
   DateTime time,
   int months
);
Parameters:

time

The DateTime to which to add months.

months

The number of months to add.

Return Value:
The DateTime that results from adding the specified number of months to the specified DateTime.
Exceptions
Exception Type Condition
ArgumentException The resulting DateTime is outside the supported range.
ArgumentOutOfRangeException months is less than -120000.

-or-

months is greater than 120000.

Remarks
The year part of the resulting DateTime is affected if the resulting month is beyond the last month of the current year. The day part of the resulting DateTime is also affected if the resulting day is not a valid day in the resulting month of the resulting year; it is changed to the last valid day in the resulting month of the resulting year. The time-of-day part of the resulting DateTime remains the same as the specified DateTime.

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.

See also:
DateTime | JapaneseCalendar.AddYears

Return to top


Method: AddSeconds(
   DateTime time,
   int seconds
)
Inherited
See base class member description: System.Globalization.Calendar.AddSeconds

Summary
Returns a DateTime that is the specified number of seconds away from the specified DateTime.
C# Syntax:
public virtual DateTime AddSeconds(
   DateTime time,
   int seconds
);
Parameters:

time

The DateTime to which to add seconds.

seconds

The number of seconds to add.

Return Value:
The DateTime that results from adding the specified number of seconds to the specified DateTime.
Exceptions
Exception Type Condition
ArgumentException The resulting DateTime is outside the supported range.
Remarks
The value parameter is rounded to the nearest millisecond before it is added to the specified DateTime. If value is negative, the resulting DateTime is earlier than the specified DateTime.
See also:
DateTime | Calendar.AddYears | Calendar.AddMonths | Calendar.AddWeeks | Calendar.AddDays | Calendar.AddHours | Calendar.AddMinutes | Calendar.AddMilliseconds

Return to top


Method: AddWeeks(
   DateTime time,
   int weeks
)
Inherited
See base class member description: System.Globalization.Calendar.AddWeeks

Summary
Returns a DateTime that is the specified number of weeks away from the specified DateTime.
C# Syntax:
public virtual DateTime AddWeeks(
   DateTime time,
   int weeks
);
Parameters:

time

The DateTime to which to add weeks.

weeks

The number of weeks to add.

Return Value:
The DateTime that results from adding the specified number of weeks to the specified DateTime.
Exceptions
Exception Type Condition
ArgumentException The resulting DateTime is outside the supported range.
Remarks
If weeks is negative, the resulting DateTime is earlier than the specified DateTime.

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.

See also:
DateTime | Calendar.AddYears | Calendar.AddMonths | Calendar.AddDays | Calendar.AddHours | Calendar.AddMinutes | Calendar.AddSeconds | Calendar.AddMilliseconds

Return to top


Overridden Method: AddYears(
   DateTime time,
   int years
)
Summary
Returns a DateTime that is the specified number of years away from the specified DateTime.
C# Syntax:
public override DateTime AddYears(
   DateTime time,
   int years
);
Parameters:

time

The DateTime to which to add years.

years

The number of years to add.

Return Value:
The DateTime that results from adding the specified number of years to the specified DateTime.
Exceptions
Exception Type Condition
ArgumentException The resulting DateTime is outside the supported range.
Remarks
The day part of the resulting DateTime is affected if the resulting day is not a valid day in the resulting month of the resulting year; it is changed to the last valid day in the resulting month of the resulting year. The time-of-day part of the resulting DateTime remains the same as the specified DateTime.

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.

See also:
DateTime | JapaneseCalendar.AddMonths

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~JapaneseCalendar();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: GetDayOfMonth(
   DateTime time
)
Summary
Returns the day of the month in the specified DateTime.
C# Syntax:
public override int GetDayOfMonth(
   DateTime time
);
Parameters:

time

The DateTime to read.

Return Value:
An integer from 1 to 31 that represents the day of the month in the specified DateTime.
See also:
DateTime.Day | JapaneseCalendar.GetEra | JapaneseCalendar.GetYear | JapaneseCalendar.GetMonth | JapaneseCalendar.GetDayOfYear | JapaneseCalendar.GetDayOfWeek

Return to top


Overridden Method: GetDayOfWeek(
   DateTime time
)
Summary
Returns the day of the week in the specified DateTime.
C# Syntax:
public override DayOfWeek GetDayOfWeek(
   DateTime time
);
Parameters:

time

The DateTime to read.

Return Value:
A DayOfWeek value that represents the day of the week in the specified DateTime.
Remarks
The DayOfWeek values are as follows:

DayOfWeek value which indicates
Sunday 日曜日 (Nichiyoubi)
Monday 月曜日 (Getsuyoubi)
Tuesday 火曜日 (Kayoubi)
Wednesday 水曜日 (Suiyoubi)
Thursday 木曜日 (Mokuyoubi)
Friday 金曜日 (Kinyoubi)
Saturday 土曜日 (Doyoubi)
See also:
DateTime.DayOfWeek | DayOfWeek | JapaneseCalendar.GetEra | JapaneseCalendar.GetYear | JapaneseCalendar.GetMonth | JapaneseCalendar.GetDayOfYear | JapaneseCalendar.GetDayOfMonth

Return to top


Overridden Method: GetDayOfYear(
   DateTime time
)
Summary
Returns the day of the year in the specified DateTime.
C# Syntax:
public override int GetDayOfYear(
   DateTime time
);
Parameters:

time

The DateTime to read.

Return Value:
An integer from 1 to 366 that represents the day of the year in the specified DateTime.
See also:
DateTime.DayOfYear | JapaneseCalendar.GetEra | JapaneseCalendar.GetYear | JapaneseCalendar.GetMonth | JapaneseCalendar.GetDayOfMonth | JapaneseCalendar.GetDayOfWeek

Return to top


Overloaded Method: GetDaysInMonth(
   int year,
   int month
)
Inherited
See base class member description: System.Globalization.Calendar.GetDaysInMonth

Summary
Returns the number of days in the specified month in the specified year in the current era.
C# Syntax:
public virtual int GetDaysInMonth(
   int year,
   int month
);
Parameters:

year

An integer that represents the year.

month

An integer that represents the month.

Return Value:
The number of days in the specified month in the specified year in the current era.
Exceptions
Exception Type Condition
ArgumentException year is outside the range supported by the calendar.

-or-

month is outside the range supported by the calendar.

Remarks
For example, in the Gregorian calendar, this method returns 28 or 29 for February (month = 2), depending on whether year is a leap year.
See also:
GregorianCalendar | Calendar.GetMonthsInYear | Calendar.GetDaysInYear

Return to top


Overloaded Method: GetDaysInMonth(
   int year,
   int month,
   int era
)
Summary
Returns the number of days in the specified month in the specified year in the specified era.
C# Syntax:
public override int GetDaysInMonth(
   int year,
   int month,
   int era
);
Parameters:

year

An integer that represents the year.

month

An integer that represents the month.

era

An integer that represents the era.

Return Value:
The number of days in the specified month in the specified year in the specified era.
Exceptions
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.

Remarks
For example, this method returns 28 or 29 for Nigatsu (February, month = 2), depending on whether year is a leap year.
See also:
JapaneseCalendar.Eras | JapaneseCalendar.GetMonthsInYear | JapaneseCalendar.GetDaysInYear

Return to top


Overloaded Method: GetDaysInYear(
   int year
)
Inherited
See base class member description: System.Globalization.Calendar.GetDaysInYear

Summary
Returns the number of days in the specified year in the current era.
C# Syntax:
public virtual int GetDaysInYear(
   int year
);
Parameters:

year

An integer that represents the year.

Return Value:
The number of days in the specified year in the current era.
Exceptions
Exception Type Condition
ArgumentException year is outside the range supported by the calendar.
Remarks
For example, in the Gregorian calendar, this method returns 365 or 366, depending on whether year is a leap year.
See also:
GregorianCalendar | Calendar.GetMonthsInYear | Calendar.GetDaysInMonth

Return to top


Overloaded Method: GetDaysInYear(
   int year,
   int era
)
Summary
Returns the number of days in the specified year in the specified era.
C# Syntax:
public override int GetDaysInYear(
   int year,
   int era
);
Parameters:

year

An integer that represents the year.

era

An integer that represents the era.

Return Value:
The number of days in the specified year in the specified era.
Exceptions
Exception Type Condition
ArgumentException year is outside the range supported by the calendar. -or-

era is outside the range supported by the calendar.

Remarks
For example, this method returns 365 or 366, depending on whether year is a leap year.
See also:
JapaneseCalendar.Eras | JapaneseCalendar.GetMonthsInYear | JapaneseCalendar.GetDaysInMonth

Return to top


Overridden Method: GetEra(
   DateTime time
)
Summary
Returns the era in the specified DateTime.
C# Syntax:
public override int GetEra(
   DateTime time
);
Parameters:

time

The DateTime to read.

Return Value:
An integer that represents the era in the specified DateTime.
Remarks
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.

See also:
DateTime | JapaneseCalendar.Eras | JapaneseCalendar.GetYear | JapaneseCalendar.GetMonth | JapaneseCalendar.GetDayOfYear | JapaneseCalendar.GetDayOfMonth | JapaneseCalendar.GetDayOfWeek

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetHour(
   DateTime time
)
Inherited
See base class member description: System.Globalization.Calendar.GetHour

Summary
Returns the hours value in the specified DateTime.
C# Syntax:
public virtual int GetHour(
   DateTime time
);
Parameters:

time

The DateTime to read.

Return Value:
An integer from 0 to 23 that represents the hour in time.
See also:
DateTime.Hour | Calendar.GetEra | Calendar.GetYear | Calendar.GetMonth | Calendar.GetWeekOfYear | Calendar.GetDayOfYear | Calendar.GetDayOfMonth | Calendar.GetDayOfWeek | Calendar.GetMinute | Calendar.GetSecond | Calendar.GetMilliseconds

Return to top


Method: GetMilliseconds(
   DateTime time
)
Inherited
See base class member description: System.Globalization.Calendar.GetMilliseconds

Summary
Returns the milliseconds value in the specified DateTime.
C# Syntax:
public virtual double GetMilliseconds(
   DateTime time
);
Parameters:

time

The DateTime to read.

Return Value:
An integer that represents the milliseconds in time.
Remarks
The returned value is an integer from 0 to 999.
See also:
DateTime.Millisecond | Calendar.GetEra | Calendar.GetYear | Calendar.GetMonth | Calendar.GetWeekOfYear | Calendar.GetDayOfYear | Calendar.GetDayOfMonth | Calendar.GetDayOfWeek | Calendar.GetHour | Calendar.GetMinute | Calendar.GetSecond

Return to top


Method: GetMinute(
   DateTime time
)
Inherited
See base class member description: System.Globalization.Calendar.GetMinute

Summary
Returns the minutes value in the specified DateTime.
C# Syntax:
public virtual int GetMinute(
   DateTime time
);
Parameters:

time

The DateTime to read.

Return Value:
An integer that represents the minutes in time.
Remarks
The returned value is an integer from 0 to 59.
See also:
DateTime.Minute | Calendar.GetEra | Calendar.GetYear | Calendar.GetMonth | Calendar.GetWeekOfYear | Calendar.GetDayOfYear | Calendar.GetDayOfMonth | Calendar.GetDayOfWeek | Calendar.GetHour | Calendar.GetSecond | Calendar.GetMilliseconds

Return to top


Overridden Method: GetMonth(
   DateTime time
)
Summary
Returns the month in the specified DateTime.
C# Syntax:
public override int GetMonth(
   DateTime time
);
Parameters:

time

The DateTime to read.

Return Value:
An integer between 1 and 12 that represents the month in the specified DateTime.
See also:
DateTime.Month | JapaneseCalendar.GetEra | JapaneseCalendar.GetYear | JapaneseCalendar.GetDayOfYear | JapaneseCalendar.GetDayOfMonth | JapaneseCalendar.GetDayOfWeek

Return to top


Overloaded Method: GetMonthsInYear(
   int year
)
Inherited
See base class member description: System.Globalization.Calendar.GetMonthsInYear

Summary
Returns the number of months in the specified year in the current era.
C# Syntax:
public virtual int GetMonthsInYear(
   int year
);
Parameters:

year

An integer that represents the year.

Return Value:
The number of months in the specified year in the current era.
Exceptions
Exception Type Condition
ArgumentException year is outside the range supported by the calendar.
See also:
Calendar.GetDaysInYear | Calendar.GetDaysInMonth

Return to top


Overloaded Method: GetMonthsInYear(
   int year,
   int era
)
Summary
Returns the number of months in the specified year in the specified era.
C# Syntax:
public override int GetMonthsInYear(
   int year,
   int era
);
Parameters:

year

An integer that represents the year.

era

An integer that represents the era.

Return Value:
The number of months in the specified year in the specified era.
Exceptions
Exception Type Condition
ArgumentException year is outside the range supported by the calendar.

-or-

era is outside the range supported by the calendar.

See also:
JapaneseCalendar.Eras | JapaneseCalendar.GetDaysInYear | JapaneseCalendar.GetDaysInMonth

Return to top


Method: GetSecond(
   DateTime time
)
Inherited
See base class member description: System.Globalization.Calendar.GetSecond

Summary
Returns the seconds value in the specified DateTime.
C# Syntax:
public virtual int GetSecond(
   DateTime time
);
Parameters:

time

The DateTime to read.

Return Value:
An integer that represents the seconds in time.
Remarks
The returned value is an integer from 0 to 59.
See also:
DateTime.Second | Calendar.GetEra | Calendar.GetYear | Calendar.GetMonth | Calendar.GetWeekOfYear | Calendar.GetDayOfYear | Calendar.GetDayOfMonth | Calendar.GetDayOfWeek | Calendar.GetHour | Calendar.GetMinute | Calendar.GetMilliseconds

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetWeekOfYear(
   DateTime time,
   CalendarWeekRule rule,
   DayOfWeek firstDayOfWeek
)
Inherited
See base class member description: System.Globalization.Calendar.GetWeekOfYear

Summary
Returns the week of the year that includes the date in the specified DateTime.
C# Syntax:
public virtual int GetWeekOfYear(
   DateTime time,
   CalendarWeekRule rule,
   DayOfWeek firstDayOfWeek
);
Parameters:

time

The DateTime to read.

rule

A CalendarWeekRule value that defines a calendar week.

firstDayOfWeek

A DayOfWeek value that represents the first day of the week.

Return Value:
An integer that represents the week of the year that includes the date in time.
Exceptions
Exception Type Condition
ArgumentOutOfRangeException firstDayOfWeek is outside the range supported by the calendar.

-or-

rule is not a valid CalendarWeekRule value.

Remarks
DateTimeFormatInfo.FirstDayOfWeek of CultureInfo.DateTimeFormat contains the default DayOfWeek value that represents the first day of the week for a specific culture.

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.

See also:
DateTime | CalendarWeekRule | DayOfWeek | Calendar.GetEra | Calendar.GetYear | Calendar.GetMonth | Calendar.GetDayOfYear | Calendar.GetDayOfMonth | Calendar.GetDayOfWeek | Calendar.GetHour | Calendar.GetMinute | Calendar.GetSecond | Calendar.GetMilliseconds

Return to top


Overridden Method: GetYear(
   DateTime time
)
Summary
Returns the year in the specified DateTime.
C# Syntax:
public override int GetYear(
   DateTime time
);
Parameters:

time

The DateTime to read.

Return Value:
An integer between 1 and 9999 that represents the year in the specified DateTime.
See also:
DateTime.Year | JapaneseCalendar.GetEra | JapaneseCalendar.GetMonth | JapaneseCalendar.GetDayOfYear | JapaneseCalendar.GetDayOfMonth | JapaneseCalendar.GetDayOfWeek

Return to top


Overloaded Method: IsLeapDay(
   int year,
   int month,
   int day
)
Inherited
See base class member description: System.Globalization.Calendar.IsLeapDay

Summary
Determines whether the specified date in the current era is a leap day.
C# Syntax:
public virtual bool IsLeapDay(
   int year,
   int month,
   int day
);
Parameters:

year

An integer that represents the year.

month

An integer that represents the month.

day

An integer that represents the day.

Return Value:
true if the specified day is a leap day; otherwise, false.
Exceptions
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.

Remarks
In order to make up for the difference between the calendar year and the actual time that the earth rotates around the sun or the actual time that the moon rotates around the earth, a leap year has a different number of days than a standard calendar year. Each Calendar implementation defines leap years differently.

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.

See also:
Calendar.GetMonthsInYear | Calendar.GetDaysInMonth | Calendar.IsLeapYear | Calendar.IsLeapMonth

Return to top


Overloaded Method: IsLeapDay(
   int year,
   int month,
   int day,
   int era
)
Summary
Determines whether the specified date in the specified era is a leap day.
C# Syntax:
public override bool IsLeapDay(
   int year,
   int month,
   int day,
   int era
);
Parameters:

year

An integer that represents the year.

month

An integer that represents the month.

day

An integer that represents the day.

era

An integer that represents the era.

Return Value:
true, if the specified day is a leap day; otherwise, false.
Exceptions
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.

Remarks
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.

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.

See also:
JapaneseCalendar.Eras | JapaneseCalendar.GetMonthsInYear | JapaneseCalendar.GetDaysInMonth | JapaneseCalendar.IsLeapYear | JapaneseCalendar.IsLeapMonth

Return to top


Overloaded Method: IsLeapMonth(
   int year,
   int month
)
Inherited
See base class member description: System.Globalization.Calendar.IsLeapMonth

Summary
Determines whether the specified month in the specified year in the current era is a leap month.
C# Syntax:
public virtual bool IsLeapMonth(
   int year,
   int month
);
Parameters:

year

An integer that represents the year.

month

An integer that represents the month.

Return Value:
true if the specified month is a leap month; otherwise, false.
Exceptions
Exception Type Condition
ArgumentException year is outside the range supported by the calendar.

-or-

month is outside the range supported by the calendar.

Remarks
In order to make up for the difference between the calendar year and the actual time that the earth rotates around the sun or the actual time that the moon rotates around the earth, a leap year has a different number of days than a standard calendar year. Each Calendar implementation defines leap years differently.

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.

See also:
Calendar.GetMonthsInYear | Calendar.IsLeapYear | Calendar.IsLeapDay

Return to top


Overloaded Method: IsLeapMonth(
   int year,
   int month,
   int era
)
Summary
Determines whether the specified month in the specified year in the specified era is a leap month.
C# Syntax:
public override bool IsLeapMonth(
   int year,
   int month,
   int era
);
Parameters:

year

An integer that represents the year.

month

An integer that represents the month.

era

An integer that represents the era.

Return Value:
This method always returns false, unless overridden by a derived class.
Exceptions
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.

Remarks
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.

A leap month is an entire month that occurs only in a leap year. The Japanese calendar does not have any leap months.

See also:
JapaneseCalendar.Eras | JapaneseCalendar.GetMonthsInYear | JapaneseCalendar.IsLeapYear | JapaneseCalendar.IsLeapDay

Return to top


Overloaded Method: IsLeapYear(
   int year
)
Inherited
See base class member description: System.Globalization.Calendar.IsLeapYear

Summary
Determines whether the specified year in the current era is a leap year.
C# Syntax:
public virtual bool IsLeapYear(
   int year
);
Parameters:

year

An integer that represents the year.

Return Value:
true if the specified year is a leap year; otherwise, false.
Exceptions
Exception Type Condition
ArgumentException year is outside the range supported by the calendar.
Remarks
In order to make up for the difference between the calendar year and the actual time that the earth rotates around the sun or the actual time that the moon rotates around the earth, a leap year has a different number of days than a standard calendar year. Each Calendar implementation defines leap years differently.
See also:
Calendar.IsLeapMonth | Calendar.IsLeapDay

Return to top


Overloaded Method: IsLeapYear(
   int year,
   int era
)
Summary
Determines whether the specified year in the specified era is a leap year.
C# Syntax:
public override bool IsLeapYear(
   int year,
   int era
);
Parameters:

year

An integer that represents the year.

era

An integer that represents the era.

Return Value:
true, if the specified year is a leap year; otherwise, false.
Exceptions
Exception Type Condition
ArgumentException year is outside the range supported by the calendar.

-or-

era is outside the range supported by the calendar.

Remarks
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.
See also:
JapaneseCalendar.Eras | JapaneseCalendar.IsLeapMonth | JapaneseCalendar.IsLeapDay

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Overloaded Method: ToDateTime(
   int year,
   int month,
   int day,
   int hour,
   int minute,
   int second,
   int millisecond
)
Inherited
See base class member description: System.Globalization.Calendar.ToDateTime

Summary
Returns a DateTime that is set to the specified date and time in the current era.
C# Syntax:
public virtual DateTime ToDateTime(
   int year,
   int month,
   int day,
   int hour,
   int minute,
   int second,
   int millisecond
);
Parameters:

year

An integer that represents the year.

month

An integer that represents the month.

day

An integer that represents the day.

hour

An integer that represents the hour.

minute

An integer that represents the minute.

second

An integer that represents the second.

millisecond

An integer that represents the millisecond.

Return Value:
The DateTime that is set to the specified date and time in the current era.
Exceptions
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.

See also:
DateTime | Calendar.GetMonthsInYear | Calendar.GetDaysInMonth

Return to top


Overloaded Method: ToDateTime(
   int year,
   int month,
   int day,
   int hour,
   int minute,
   int second,
   int millisecond,
   int era
)
Summary
Returns a DateTime that is set to the specified date and time in the specified era.
C# Syntax:
public override DateTime ToDateTime(
   int year,
   int month,
   int day,
   int hour,
   int minute,
   int second,
   int millisecond,
   int era
);
Parameters:

year

An integer that represents the year.

month

An integer that represents the month.

day

An integer that represents the day.

hour

An integer that represents the hour.

minute

An integer that represents the minute.

second

An integer that represents the second.

millisecond

An integer that represents the millisecond.

era

An integer that represents the era.

Return Value:
The DateTime that is set to the specified date and time in the current era.
Exceptions
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.

See also:
DateTime | JapaneseCalendar.Eras | JapaneseCalendar.GetMonthsInYear | JapaneseCalendar.GetDaysInMonth

Return to top


Overridden Method: ToFourDigitYear(
   int year
)
Summary
Converts the specified two-digit year to a four-digit year by using the JapaneseCalendar.TwoDigitYearMax property to determine the appropriate century.
C# Syntax:
public override int ToFourDigitYear(
   int year
);
Parameters:

year

A two-digit integer that represents the year to convert.

Return Value:
An integer that contains the four-digit representation of year.
Exceptions
Exception Type Condition
ArgumentException year is outside the range supported by the calendar.
Remarks
This method implements Calendar.ToFourDigitYear.

Because the year in the Japanese calendar is typically less than four digits long, this implementation always returns the value of the year parameter.

See also:
JapaneseCalendar.TwoDigitYearMax

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.