0

In my Angular 6 project, I have the following code:

const date1 = new Date(2018, 9, 17);
console.log('date1 = ', date1);

But I get the following result in the cosole of my browser:

date1 =  Wed Oct 17 2018 00:00:00 GMT+0200 (Central European Summer Time)

Why do I get Oct but not Sept?

Bohao LI
  • 2,123
  • 2
  • 18
  • 24

1 Answers1

0

That is because

The argument monthIndex is 0-based. This means that January = 0 and December = 11.

For More: Date Parameters

Community
  • 1
  • 1
Mamun
  • 66,969
  • 9
  • 47
  • 59