Why does the month argument range from 0 to 11 in JavaScript's Date constructor?

后端 未结 8 1142
生来不讨喜
生来不讨喜 2020-11-22 15:31

When initializing a new Date object in JavaScript using the below call, I found out that the month argument counts starting from zero.

new Date(         


        
8条回答
  •  -上瘾入骨i
    2020-11-22 15:58

    It's an old (probably unfortunate, probably dying) tradition in the programming world, see the old standard (POSIX) localtime C function http://linux.die.net/man/3/localtime

提交回复
热议问题