C#日付/時刻DateTime.DaysInMonth
DateTime.TryParse

DateTime.DaysInMonth日付/時刻

DateTime.IsLeapYear

指定した月の日数を返します。

문법

DateTime.DaysInMonth(year, month)

예제

아래 값을 입력하면 예제에 즉시 반영됩니다.

Console
WriteLine
DaysInMonth
leap
Console.WriteLine(DateTime.DaysInMonth(2024, 2));   // 29 (leap year)
Console.WriteLine(DateTime.DaysInMonth(2023, 2));   // 28