CalendarSystem GetMonthsInYear Method Noda Time

[This is preliminary documentation and is subject to change.]

Returns the maximum valid month (inclusive) within this calendar in the given year.

Namespace: NodaTime
Assembly: NodaTime (in NodaTime.dll) Version: (

public int GetMonthsInYear(
	int year

Return Value

Type: OnlineInt32
The maximum month number within the given year.

OnlineSystem ArgumentOutOfRangeExceptionThe given year is invalid for this calendar. Note that some implementations may return a month rather than throw this exception (for example, if all years have the same number of months in this calendar system). Failure to throw an exception should not be treated as an indication that the year is valid.

It is assumed that in all calendars, every month between 1 and this month number is valid for the given year. This does not necessarily mean that the first month of the year is 1, however. (See the Hebrew calendar system using the scriptural month numbering system for example.)
Version Information

Available since: 2.0.0
Supported in the PCL? Yes
See Also