Skip to content Skip to sidebar Skip to footer

.getday() Strange Behaviour

There is an example console.log((new Date(2013, 02, 24)).getDay(), 24) // => 0 24 console.log((new Date(2013, 02, 25)).getDay(), 25) // => 1 25 console.log((new Date(2013, 02

Solution 1:

When setting the date, passing 2 means March as it is 0 based. If you use 1 for february it will work as expected.

Quoting https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date

month Integer value representing the month, beginning with 0 for January to 11 for December.

Post a Comment for ".getday() Strange Behaviour"