I want to set the time to the 1st January 0000
and time at 00:00:00
i tried to calculate a lot but i’m unable to set the date to the beginning point.
I am setting the date with negative sign like this –
new Date(-4000)
but setting the year to 0 gives me only the 1900
so how can get to the perfect date of 1st Jan 0000
and time at 00:00:00
.
Answer
The way you were doing you can also set it, to -62167219200000
it will return the same results as new Date("0000-01-01")
const d = new Date(-62167219200000); console.log(d);
Only will set the date to 0 not the time