# MQTT Time Stamp Error

**URL:** <https://discourse.nodered.org/t/mqtt-time-stamp-error/38787>\
**Category:** General\
**Created:** [8 January 2021 12:44 UTC](https://discourse.nodered.org/t/mqtt-time-stamp-error/38787 "2021-01-08T12:44:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarcoVg](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@MarcoVg](https://discourse.nodered.org/u/MarcoVg)\
**Post date:** [8 January 2021 12:44 UTC](https://discourse.nodered.org/t/mqtt-time-stamp-error/38787/1 "2021-01-08T12:44:43Z")

</div>

Dear to All,  
I am receive from a Mqqt Broker a correct Json Object. But I have attached error about the time stamp.

 ![TimeSTamp](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/c/acf5237f972d5b9f9d95ada6d95da75f8bc33466.jpeg)

What is it mean?

---

<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:** [8 January 2021 12:55 UTC](https://discourse.nodered.org/t/mqtt-time-stamp-error/38787/2 "2021-01-08T12:55:58Z")

</div>

It means what it says , it expected an numeric time stamp, but received an ISO time string.

You will need to put a function or change node and convert the value.

---

<div class="post-metadata">

**Author:** ![vikozo](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@vikozo](https://discourse.nodered.org/u/vikozo)\
**Post date:** [8 January 2021 13:07 UTC](https://discourse.nodered.org/t/mqtt-time-stamp-error/38787/3 "2021-01-08T13:07:43Z")

</div>

just a couple of minutes ago i solved this same Problem  
you add a function node with

```auto
msg.payload = {
id: msg.payload.id,
model: msg.payload.model,
temperature_C: msg.payload.temperature_C,
humidity: msg.payload.humidity
}
return msg;

```

so you just give a id and from the originalPayload you copy the information, start with temperature and then add on by on

---

<div class="post-metadata">

**Author:** ![MarcoVg](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@MarcoVg](https://discourse.nodered.org/u/MarcoVg)\
**Post date:** [8 January 2021 13:08 UTC](https://discourse.nodered.org/t/mqtt-time-stamp-error/38787/4 "2021-01-08T13:08:18Z")

</div>

Thanks for the support,  
I am try the following function, but what I need to write, in replace field ?  
Thanks

 ![TimeSTamp_1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/f/9f4e70032dff626b490561722f9304a6589c36c9.jpeg)

---

<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:** [8 January 2021 13:18 UTC](https://discourse.nodered.org/t/mqtt-time-stamp-error/38787/5 "2021-01-08T13:18:04Z")

</div>

```auto
[{"id":"5d7bf8ba.18af5","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload[0][0].time","v":"2021-01-08T12:34:34.779Z","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":2940,"wires":[["a959787b.07cef"]]},{"id":"a959787b.07cef","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload[0][0].time","pt":"msg","to":"$toMillis(payload[0][0].time)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":2940,"wires":[["4dff0770.25d2c"]]},{"id":"4dff0770.25d2c","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":2860,"wires":[]}]

```

A simple example

---

<div class="post-metadata">

**Author:** ![MarcoVg](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@MarcoVg](https://discourse.nodered.org/u/MarcoVg)\
**Post date:** [8 January 2021 13:32 UTC](https://discourse.nodered.org/t/mqtt-time-stamp-error/38787/6 "2021-01-08T13:32:54Z")

</div>

Thanks E1cid, It is works!!!.

But the problem is that now influx DB doesn't show any measuraments, because is not present the databese time...

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 January 2021 13:54 UTC](https://discourse.nodered.org/t/mqtt-time-stamp-error/38787/8 "2021-01-08T13:54:10Z")

</div>

Are you trying to add a record for the current time? If so then you don't need to put the timestamp in at all, just delete it from the payload.

Also show us what is in the other element of the array.

---

<div class="post-metadata">

**Author:** ![MarcoVg](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@MarcoVg](https://discourse.nodered.org/u/MarcoVg)\
**Post date:** [8 January 2021 14:06 UTC](https://discourse.nodered.org/t/mqtt-time-stamp-error/38787/9 "2021-01-08T14:06:39Z")

</div>

OK!!, It is working, Tnx to all

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 March 2021 14:06 UTC](https://discourse.nodered.org/t/mqtt-time-stamp-error/38787/10 "2021-03-09T14:06:54Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
