DateTime..::..DaysInMonth Method
Returns the number of days in the specified month and year.
Namespace:
SystemAssembly: Bridge (in Bridge.dll)
Syntax
[TemplateAttribute] public static int DaysInMonth( int year, int month )
<TemplateAttribute> _ Public Shared Function DaysInMonth ( _ year As Integer, _ month As Integer _ ) As Integer
[TemplateAttribute] public: static int^ DaysInMonth( int^ year, int^ month )
Parameters
- year
- Type: System..::..Int32
The year.
- month
- Type: System..::..Int32
The month (a number ranging from 1 to 12).
Return Value
The number of days in month for the specified year.For example, if month equals 2 for February, the return value is 28 or 29 depending upon whether year is a leap year.Exceptions
Exception | Condition |
---|---|
System..::..ArgumentOutOfRangeException | month is less than 1 or greater than 12.-or-year is less than 1 or greater than 9999. |