Help with Java: timestamps result to Jan 20th 1970

This is a continuation of this topic

Your time stamps are different, the first topic they are unix milliseconds timestamps, and in this topic they are unix seconds timestamps.

Either correct the time stamps and use milliseconds in both database tables, or multiple these new timestamps by 1000.

e.g

for (i = 0; i < arrayLength; i++) {

    if (msg.type_of_data == "sum_of_minutes") {
        dt = new Date(Number(times[i]));
        x_axis = `${dt.getHours().toString().padStart(2, "0")}:${dt.getMinutes().toString().padStart(2, "0")}`;
    }
    else if (msg.type_of_data == "sum_of_days") {
        dt = new Date(Number(times[i])*1000);
        x_axis = dt.getDate();
        dummy[i] =  x_axis;
    }

    times[i] = x_axis;
};
2 Likes