Need help converting Time String to Zoned Date

Hello all,

I have a time string which i want to calculate into a Date but I get a wired result.
Here is my code

DTSTARTString = "20230210T063000"
DTSTART = new Date(parseInt(DTSTARTString.substring(0,4)), parseInt(DTSTARTString.substring(4,6)), parseInt(DTSTARTString.substring(6,8)), parseInt(DTSTARTString.substring(9,11)), parseInt(DTSTARTString.substring(11,13)), parseInt(DTSTARTString.substring(13,15)), 0);

But the result is

Fri Mar 10 2023 06:30:00 GMT+0100 (CET)

Why is it calculating to March??

Hi milo,

I see you have overlapping substrings in your calculation. Shouldn’t those be non-overlapping?

Answer is


JavaScript counts months from 0 to 11:

January = 0.

December = 11.