Month number (Time calculation)

A date and time algorithm.


ECMAScript edition - 2
Property/method value type:Number primitive

In ECMA compliant implementations, months are identified by an integer in the range 0 to 11, inclusive.

The month number is calculated by taking the number of the day at the target time and then taking the day number at the start of that year. The difference is the day number within the year, which can then be used via a compare and lookup mechanism to deduce the month. The InLeapYear() method comes into play to offset the day number by one when it is a leap year.

See also:Day number, Day within year, Month from time, Time range


ECMA 262 edition 2 - section -

ECMA 262 edition 3 - section -