DateTime.DaysInMonth メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DateTime.DaysInMonth メソッドの意味・解説 

DateTime.DaysInMonth メソッド

指定した月および年の日数返します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Shared Function DaysInMonth
 ( _
    year As Integer, _
    month As Integer _
) As Integer
public static int DaysInMonth
 (
    int year,
    int month
)
public:
static int DaysInMonth (
    int year, 
    int month
)
public static int DaysInMonth
 (
    int year, 
    int month
)
public static function DaysInMonth
 (
    year : int, 
    month : int
) : int

パラメータ

year

年。

month

月 (1 から 12 までの範囲の数)。

戻り値
指定した yearmonth日数。 たとえば、month2 月を表す 2 に等し場合戻り値には、year閏年かどうかによって 28 または 29返します

例外例外
例外種類条件

ArgumentOutOfRangeException

month1 未満か、12 よりも大きい値です。

または

year1 未満か、9999 よりも大きい値です。

使用例使用例

DaysInMonth メソッドコード例次に示します

Const July As Integer =
 7
Const Feb As Integer = 2

' daysInJuly gets 31.
Dim daysInJuly As Integer
 = System.DateTime.DaysInMonth(2001, July)

' daysInFeb gets 28 because the year 1998 was not a leap year.
Dim daysInFeb As Integer
 = System.DateTime.DaysInMonth(1998, Feb)

' daysInFebLeap gets 29 because the year 1996 was a leap year.
Dim daysInFebLeap As Integer
 = System.DateTime.DaysInMonth(1996, Feb)
const int July = 7;
const int Feb = 2;

// daysInJuly gets 31.
int daysInJuly = System.DateTime.DaysInMonth(2001, July);

// daysInFeb gets 28 because the year 1998 was not a leap year.
int daysInFeb = System.DateTime.DaysInMonth(1998, Feb);

// daysInFebLeap gets 29 because the year 1996 was a leap year.
int daysInFebLeap = System.DateTime.DaysInMonth(1996, Feb);
const int July = 7;
const int Feb = 2;

// daysInJuly gets 31.
int daysInJuly = System::DateTime::DaysInMonth( 2001, July );

// daysInFeb gets 28 because the year 1998 was not a leap year.
int daysInFeb = System::DateTime::DaysInMonth( 1998, Feb );

// daysInFebLeap gets 29 because the year 1996 was a leap year.
int daysInFebLeap = System::DateTime::DaysInMonth( 1996, Feb );
final int july = 7;
final int feb = 2;
// daysInJuly gets 31.
int daysInJuly = System.DateTime.DaysInMonth(2001, july);
// daysInFeb gets 28 because the year 1998 was not a leap year.
int daysInFeb = System.DateTime.DaysInMonth(1998, feb);
// daysInFebLeap gets 29 because the year 1996 was a leap year.
int daysInFebLeap = System.DateTime.DaysInMonth(1996, feb);
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からDateTime.DaysInMonth メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDateTime.DaysInMonth メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDateTime.DaysInMonth メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DateTime.DaysInMonth メソッド」の関連用語

DateTime.DaysInMonth メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DateTime.DaysInMonth メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS