次の方法で共有


Calendar.GetDaysInMonth メソッド (Int32, Int32, Int32)

派生クラスでオーバーライドされると、指定した時代 (年号) の指定した年の指定した月の日数を返します。

Overloads Public MustOverride Function GetDaysInMonth( _
   ByVal year As Integer, _   ByVal month As Integer, _   ByVal era As Integer _) As Integer
[C#]
public abstract int GetDaysInMonth(intyear,intmonth,intera);
[C++]
public: virtual int GetDaysInMonth(intyear,intmonth,intera) = 0;
[JScript]
public abstract function GetDaysInMonth(
   year : int,month : int,era : int) : int;

パラメータ

  • year
    年を表す整数。
  • month
    月を表す 1 から始まる整数。
  • era
    時代 (年号) を表す整数。

戻り値

指定した時代 (年号) の指定した年の指定した月の日数。

例外

例外の種類 条件
ArgumentOutOfRangeException year が暦でサポートされている範囲外の値です。

または

month が暦でサポートされている範囲外の値です。

または

era が暦でサポートされている範囲外の値です。

解説

たとえば、 GregorianCalendar では、2 月には GetDaysInMonth は平年では 28 を、閏年では 29 を返します。

継承時の注意: 派生クラスは、 era パラメータとして渡されるときは、 CurrentEra をサポートしている必要があります。 CurrentEra をサポートする 1 つの方法は、これを、暦の現在の時代 (年号) の値を表す Eras[0] に格納されている値と置き換えることです。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

Calendar クラス | Calendar メンバ | System.Globalization 名前空間 | Calendar.GetDaysInMonth オーバーロードの一覧 | GregorianCalendar | CurrentEra | Eras | GetMonthsInYear | GetDaysInYear