I have this basic function to convert my unix timestamps into a date string. I have seen that it returns the wrong month (29-10 instead of 29-11). I was able to reproduce it on JsFiddle. What could be the problem?
function unixTime(unixtime) {
var u = new Date(unixtime*1000);
return u.getUTCFullYear() +
'-' + ('0' + u.getUTCMonth()).slice(-2) +
'-' + ('0' + u.getUTCDate()).slice(-2)
// ' ' + ('0' + u.getUTCHours()).slice(-2) +
// ':' + ('0' + u.getUTCMinutes()).slice(-2) +
// ':' + ('0' + u.getUTCSeconds()).slice(-2)
}
var test = unixTime(1638178329);
console.log(test);