# Inserting a time format to influxdb - 8:45:00

**URL:** <https://discourse.nodered.org/t/inserting-a-time-format-to-influxdb-800/93717>\
**Category:** General\
**Created:** [6 December 2024 00:16 UTC](https://discourse.nodered.org/t/inserting-a-time-format-to-influxdb-800/93717 "2024-12-06T00:16:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![richiep](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@richiep](https://discourse.nodered.org/u/richiep)\
**Post date:** [6 December 2024 00:16 UTC](https://discourse.nodered.org/t/inserting-a-time-format-to-influxdb-800/93717/1 "2024-12-06T00:16:30Z")

</div>

Hey All,  
I'm using the Hourglass Pallet to record how many hours I have a fire in my Rocket Mass Heater each day. At just before midnight I want to send the daily burn time to influxdb and graph it. I'm able to do this when I just send the hrs burned but not the minuets.

I wrote a function to merge the time format to a payload that looks like this, 8:45:00

This makes it to influxdb. I know this because I see the variable in Grafana. However when I try to graph it in Grafana it says there is no data. I've set the units to "time duration HH:MM:SS

How can I grafana to recognize this data?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/7/27b54fed7513db4d8f4922702f54ab6f70c570ba.png)

---

<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:** [6 December 2024 07:20 UTC](https://discourse.nodered.org/t/inserting-a-time-format-to-influxdb-800/93717/2 "2024-12-06T07:20:49Z")

</div>

In the influx node set the timestamp resolution to milliseconds, then set the value of the `time` field to the JavaScript Date milliseconds of the start of the hour.

---

<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:** [6 December 2024 08:43 UTC](https://discourse.nodered.org/t/inserting-a-time-format-to-influxdb-800/93717/3 "2024-12-06T08:43:05Z")

</div>

Sorry, I meant to say the milliseconds for whatever time you want.

---

<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:** [6 December 2024 13:15 UTC](https://discourse.nodered.org/t/inserting-a-time-format-to-influxdb-800/93717/4 "2024-12-06T13:15:26Z")

</div>

> [@richiep](#):
>
> that looks like this, 8:45:00

To build on Colin's answer, what you have done I believe is give InfluxDB some TEXT rather than a number which is what it needs to be able to calculate on. Values should pretty much always be numbers in InfluxDB.

---

<div class="post-metadata">

**Author:** ![richiep](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@richiep](https://discourse.nodered.org/u/richiep)\
**Post date:** [6 December 2024 18:20 UTC](https://discourse.nodered.org/t/inserting-a-time-format-to-influxdb-800/93717/5 "2024-12-06T18:20:03Z")

</div>

hmm, still struggling. Here is my flow

```auto
[
    {
        "id": "b36e6ffdfe2e4a84",
        "type": "inject",
        "z": "0e9443b6465b78e6",
        "g": "67afd73c146e47be",
        "name": "hrs burned to database",
        "props": [
            {
                "p": "payload[0]",
                "v": "hrsBurned",
                "vt": "flow"
            },
            {
                "p": "payload[1]",
                "v": "minsBurned",
                "vt": "flow"
            }
        ],
        "repeat": "",
        "crontab": "58 23 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 250,
        "y": 1080,
        "wires": [
            [
                "054a17241739ac59"
            ]
        ]
    },
    {
        "id": "054a17241739ac59",
        "type": "function",
        "z": "0e9443b6465b78e6",
        "g": "67afd73c146e47be",
        "name": "function 26",
        "func": "let hrs = parseFloat(msg.payload[0]);\nlet mins = parseFloat(msg.payload[1]);\nmsg.payload = ((hrs) + \":\" + (mins) + \":00\");\nreturn msg; ",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 1080,
        "wires": [
            [
                "80d14ec3802dc722",
                "078dd60bd49ba231"
            ]
        ]
    },
    {
        "id": "80d14ec3802dc722",
        "type": "debug",
        "z": "0e9443b6465b78e6",
        "g": "67afd73c146e47be",
        "name": "debug 467",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 790,
        "y": 1080,
        "wires": []
    },
    {
        "id": "078dd60bd49ba231",
        "type": "influxdb out",
        "z": "0e9443b6465b78e6",
        "g": "67afd73c146e47be",
        "influxdb": "e5928bcbfeb0bb32",
        "name": "",
        "measurement": "hrsMinsSecBurned",
        "precision": "ms",
        "retentionPolicy": "",
        "database": "database",
        "precisionV18FluxV20": "ms",
        "retentionPolicyV18Flux": "",
        "org": "organisation",
        "bucket": "bucket",
        "x": 880,
        "y": 1000,
        "wires": []
    },
    {
        "id": "e5928bcbfeb0bb32",
        "type": "influxdb",
        "hostname": "127.0.0.1",
        "port": "8086",
        "protocol": "http",
        "database": "rmhHighLow",
        "name": "rmhHighLow",
        "usetls": false,
        "tls": "d50d0c9f.31e858",
        "influxdbVersion": "1.x",
        "url": "http://localhost:8086",
        "rejectUnauthorized": true
    },
    {
        "id": "d50d0c9f.31e858",
        "type": "tls-config",
        "name": "",
        "cert": "",
        "key": "",
        "ca": "",
        "certname": "",
        "keyname": "",
        "caname": "",
        "servername": "",
        "verifyservercert": false
    }
]

```

---

<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:** [6 December 2024 19:52 UTC](https://discourse.nodered.org/t/inserting-a-time-format-to-influxdb-800/93717/6 "2024-12-06T19:52:00Z")

</div>

Not really clear where you are now struggling. But note that if you've written text values to the db but now want numbers, you have to start over, I think that once Influx gets a specific data type for a value, it can't be later changed.

---

<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:** [20 December 2024 19:52 UTC](https://discourse.nodered.org/t/inserting-a-time-format-to-influxdb-800/93717/7 "2024-12-20T19:52:15Z")

</div>

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