# Change format of values from array from integer to unix-timestamp for a chart

**URL:** <https://discourse.nodered.org/t/change-format-of-values-from-array-from-integer-to-unix-timestamp-for-a-chart/81863>\
**Category:** General\
**Created:** [8 October 2023 19:00 UTC](https://discourse.nodered.org/t/change-format-of-values-from-array-from-integer-to-unix-timestamp-for-a-chart/81863 "2023-10-08T19:00:10Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![My\_Millenium](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@My\_Millenium](https://discourse.nodered.org/u/My_Millenium)\
**Post date:** [9 October 2023 17:29 UTC](https://discourse.nodered.org/t/change-format-of-values-from-array-from-integer-to-unix-timestamp-for-a-chart/81863/3 "2023-10-09T17:29:31Z")

</div>

> [@E1cid](#):
>
> Confused, a unix timestamp is an integer.

Yes ... But what is the problem with this?

> [@E1cid](#):
>
> Can you supply input values and expected output values, in a text format please.

This is e.g. the raw-data read from the database:

```auto
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
1696832799188	8.82
1696832859187	10.42
1696832919285	9.93
1696832979228	9.63
1696833039114	10.76
1696833099187	9.56
1696833159178	10.1
1696833219310	9.69

```

This is what the chart is receiving:  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/d/0db24d7a4e6c5ed78e4f95a8a61ce930527027f6.png)  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/9/b9a7f1213885ae188dab7c4d264104e736364625.png)  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/6/66ede234e40743271f50c2969622271f39b56cd0.png)

And this is what the chart is showing:  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/7/87ebfbb09644ea14aa783f8cbaf0a72b26d77045.png)

What I am expecting the chart to do is, to convert the x-axis to this:  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/8/98a54546a53921ad78c2a2d955fdd6b8a9b9344c.png)

If the chart receives the integer of the timestamps, it shows this:  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/4/b46d2aaa7cc5e5f90f2fde31a9ee68e4fa6d90bc.png)

If I change

```auto
dt = new Date(Number(times[i]));

```

to

```auto
dt = new Date(times[i]);

```

the result is:  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/a/cac9b1495615a26012a8238e237608281238ee28.png)

I hope I could make you understand what I am trying to do.

---

_[View the full topic](https://discourse.nodered.org/t/change-format-of-values-from-array-from-integer-to-unix-timestamp-for-a-chart/81863)._
