Visit Mozilla.org

Talk:Core JavaScript 1.5 Reference:Global Objects:Date:getMonth

From MDC

What is the reason of returning an integer between 0 and 11 instead of an integer between 1 and 12?

Well, one possible answer might be that it allows indexing into an array keyed by month, arrays being 0-indexed and all. Honestly, tho, this is an arbitrary choice, and at this point there's not much reason to wonder why it is the way it is. --Waldo 01:22, 19 December 2007 (PST)