The key thing about JavaScript's Date type is that it give you two different views of the same information: One in local time, and the other in UTC (loosely, GMT).

What's going on in your code is that new Date interprets its arguments as local time (in your timezone), but then the console displayed it in UTC (the Z suffix tells us that). Your timezone is apparently GMT+05:30, which is why the UTC version is five and a hour hours earlier than the date/time you specified to new Date.

If you'd output that date as a string in your local timezone (e.g., from toString, or using getHours and such), you would have gotten all zeros for hours, minutes, seconds, and milliseconds. It's the same information (the date is the same point in time), just two different views of it.

So the key thing is to make sure you stick with just the one view of the date, both on input and output. So you can either:

Create it like you did and output it using the local timezone functions (toString, getHours, etc.), or

Created it via Date.UTC so it interprets your arguments in UTC, and then use UTC/GMT methods when displaying it such as toISOString, getUTCHours, etc.: