# How do you convert a 10 digit unix time

**URL:** <https://discourse.nodered.org/t/how-do-you-convert-a-10-digit-unix-time/12474>\
**Category:** General\
**Created:** [21 June 2019 23:08 UTC](https://discourse.nodered.org/t/how-do-you-convert-a-10-digit-unix-time/12474 "2019-06-21T23:08:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nodecentral](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodecentral/32/10432_2.png) [@nodecentral](https://discourse.nodered.org/u/nodecentral)\
**Post date:** [21 June 2019 23:08 UTC](https://discourse.nodered.org/t/how-do-you-convert-a-10-digit-unix-time/12474/1 "2019-06-21T23:08:59Z")

</div>

Hi,

I’m trying to pull content from an online EPG, and the Start and Stop times of programmes look to only be 10 digits long, and I can’t seem to use a date time converter node e.g. Moment to convert them ?

When I do paste the same numbers into [https://www.epochconverter.com/](https://www.epochconverter.com/) to convert, that same 10 digit number was converted easily,

Here’s a picture of the data that’s returned (including the before and after attempt to convert the unix/epoch start and end times provided ), I’ve also added the flow overall

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/514e8f7f4cc431752c88874a277ad7ffe040740d.jpeg)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/ca22417f84635205b849dcd64d6fb51a71c91802.jpeg)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 June 2019 00:20 UTC](https://discourse.nodered.org/t/how-do-you-convert-a-10-digit-unix-time/12474/2 "2019-06-22T00:20:42Z")

</div>

Simply multiply the UNIX time by 1000 and it is a valid JavaScript timestamp.

---

<div class="post-metadata">

**Author:** ![Nikolay](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@Nikolay](https://discourse.nodered.org/u/Nikolay)\
**Post date:** [13 April 2021 08:09 UTC](https://discourse.nodered.org/t/how-do-you-convert-a-10-digit-unix-time/12474/3 "2021-04-13T08:09:01Z")

</div>

I have an array from a database with UNIX/epoch time format and I use this to convert all the timestamps in the array:

var i;  
for (i = 0; i \<msg.payload.length; i++) {

var now = new Date(msg.payload[i].TIMESTAMP).toLocaleString("en-GB");  
msg.payload[i].TIMESTAMP = now;

}

return msg;

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [13 April 2021 08:25 UTC](https://discourse.nodered.org/t/how-do-you-convert-a-10-digit-unix-time/12474/4 "2021-04-13T08:25:35Z")

</div>


