# Help with Java: timestamps result to Jan 20th 1970

**URL:** https://discourse.nodered.org/t/help-with-java-timestamps-result-to-jan-20th-1970/82034
**Category:** General
**Created:** [14 October 2023 20:22 UTC](https://discourse.nodered.org/t/help-with-java-timestamps-result-to-jan-20th-1970/82034 "2023-10-14T20:22:04Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [14 October 2023 21:36 UTC](https://discourse.nodered.org/t/help-with-java-timestamps-result-to-jan-20th-1970/82034/3 "2023-10-14T21:36:51Z")

</div>

This is a continuation of this topic

> [@Change format of values from array from integer to unix-timestamp for a chart](https://discourse.nodered.org/t/change-format-of-values-from-array-from-integer-to-unix-timestamp-for-a-chart/81863/3):
>
> Yes ... But what is the problem with this? This is e.g. the raw-data read from the database: 1696831539163 0 1696831601046 2.58 1696831659189 2.6 1696831719379 2.6 1696831781108 2.83 1696831839203 3.36 1696831899218 3.57 1696831959105 4.26 1696832021111 4.42 1696832079160 4.58 1696832139102 4.8 1696832199151 4.94 1696832259215 5.18 1696832319103 5.82 1696832379210 6.27 1696832439201 6.5 1696832499225 7.26 1696832559245 6.95 1696832619184 7.14 1696832679394 7.83 1696832739283 7.77 16968327991…

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

```auto
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;
};

```

---

_[View the full topic](https://discourse.nodered.org/t/help-with-java-timestamps-result-to-jan-20th-1970/82034)._
