JavaScript · Senior · Question 29 of 75

What does new Date(2025, 1, 1).getMonth() return, and which month is it?

Explanation

Months in Date are zero-based, while days start at one. It's a common source of bugs along with time zones and Date mutability. Use Intl.DateTimeFormat for formatting; the Temporal API is replacing Date.

Further reading

Problem with a question

JavaScript · Senior · question 29

Test yourself

Take the JavaScript · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz