# Error: Expected numeric value for, timestamp

**URL:** https://discourse.nodered.org/t/error-expected-numeric-value-for-timestamp/38586
**Category:** General
**Created:** [5 January 2021 12:16 UTC](https://discourse.nodered.org/t/error-expected-numeric-value-for-timestamp/38586 "2021-01-05T12:16:16Z")
**Posts on this page:** 8
**Page:** 1

<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: [5 January 2021 12:16 UTC](https://discourse.nodered.org/t/error-expected-numeric-value-for-timestamp/38586/1 "2021-01-05T12:16:16Z")

</div>

Hallo

a mqtt into Node-Red --\> into influx

i got a error like this

> 5.1.2021, 13:13:08node: 6d00231f.50158c  
> msg : error  
> "Error: Expected numeric value for, timestamp, but got '2021-01-05 12:13:10'!"

and the payload would be like this

> 5.1.2021, 13:13:08node: f5f2994b.a68ff8  
> /iot12/433MHz : msg.payload : Object  
> object  
> time: "2021-01-05 12:13:10"  
> brand: "OS"  
> model: "Oregon-THGR122N"  
> id: 126  
> channel: 2  
> battery\_ok: 1  
> temperature\_C: 1.9  
> humidity: 63

is there some magic to change the time on the fly?

have a nice day  
vinc

---

<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: [5 January 2021 13:10 UTC](https://discourse.nodered.org/t/error-expected-numeric-value-for-timestamp/38586/2 "2021-01-05T13:10:30Z")

</div>

> [@vikozo](#):
>
> is there some magic to change the time on the fly?

Yes, it using a `function` node and writing the code to do it.

Have you done a google search with something like `javascrpt convert string date/time to timestamp` and looked how others have done this?

---

<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: [5 January 2021 13:26 UTC](https://discourse.nodered.org/t/error-expected-numeric-value-for-timestamp/38586/3 "2021-01-05T13:26:30Z")

</div>

Try something like this in a function node.

```auto
[{"id":"83c682b8.032bc","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2021-01-05 12:13:10","payloadType":"str","x":210,"y":2580,"wires":[["e9247477.223b28"]]},{"id":"e9247477.223b28","type":"function","z":"8d22ae29.7df6d","name":"","func":"msg.payload = new Date(msg.payload).valueOf();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":390,"y":2580,"wires":[["6d57c0db.f2671"]]},{"id":"6d57c0db.f2671","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":640,"y":2480,"wires":[]}]

```

---

<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: [5 January 2021 14:11 UTC](https://discourse.nodered.org/t/error-expected-numeric-value-for-timestamp/38586/4 "2021-01-05T14:11:22Z")

</div>

If you are using the the influxdb node you can pass the time as a string, but I believe it should be in ISO 8601 format. so something like `yyyy-MM-ddTHH:mm:ssZ`

Edit: That is an alternative to providing a timestamp in ticks of course.

---

<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: [5 January 2021 19:35 UTC](https://discourse.nodered.org/t/error-expected-numeric-value-for-timestamp/38586/5 "2021-01-05T19:35:58Z")

</div>

@Colin @E1cid @zenofmud  
thanks for your Feedback, i will have to dig to understand to only change this "time" part of the payload

The best would be just to remove the time stamp - because it make problem and i it is 1h behind 😉

have a nice day  
vinc

---

<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: [5 January 2021 21:30 UTC](https://discourse.nodered.org/t/error-expected-numeric-value-for-timestamp/38586/6 "2021-01-05T21:30:44Z")

</div>

> [@vikozo](#):
>
> The best would be just to remove the time stamp

If you are just adding data for the current time then you don't need a timestamp, influx will use the current time.

The one hour error was likely that you were providing a local time instead of UTC. Influx expects the timestamp in UTC.

---

<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: [5 January 2021 21:33 UTC](https://discourse.nodered.org/t/error-expected-numeric-value-for-timestamp/38586/7 "2021-01-05T21:33:22Z")

</div>

@Colin  
yes it would be just the current time - mqtt - Node Red - InfluxDB - the couple of second it need is not important.

---

<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: [6 March 2021 21:33 UTC](https://discourse.nodered.org/t/error-expected-numeric-value-for-timestamp/38586/8 "2021-03-06T21:33:35Z")

</div>

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