# How display "date,value of sensor" in node red

**URL:** <https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766>\
**Category:** General\
**Tags:** function-node\
**Created:** [17 May 2022 17:08 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766 "2022-05-17T17:08:08Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zaineb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zaineb/32/61745_2.png) [@Zaineb](https://discourse.nodered.org/u/Zaineb)\
**Post date:** [17 May 2022 17:08 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/1 "2022-05-17T17:08:08Z")

</div>

Hi everyone,  
my problem is how to display my data with date, for exemple "2022-04-17, 321.76".  
thanks.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [17 May 2022 17:29 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/2 "2022-05-17T17:29:38Z")

</div>

Welcome to the forum!

You need to tell us a little more about what you are trying to do. Where is the data coming from? Where do you want to display the results?

---

<div class="post-metadata">

**Author:** ![Zaineb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zaineb/32/61745_2.png) [@Zaineb](https://discourse.nodered.org/u/Zaineb)\
**Post date:** [17 May 2022 17:41 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/3 "2022-05-17T17:41:20Z")

</div>

Data from plc 's7 node' and send data to firebase  
the value in s7 node note display with date

 ![CAP](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e5edfb980a2fb5b8dd8e96ddaa260cb2c421684.jpeg)

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [17 May 2022 18:36 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/4 "2022-05-17T18:36:24Z")

</div>

Can you post your flow here please?  
Export your flow to the clipboard, press the `</>` button above and paste your flow between the back ticks.

---

<div class="post-metadata">

**Author:** ![Zaineb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zaineb/32/61745_2.png) [@Zaineb](https://discourse.nodered.org/u/Zaineb)\
**Post date:** [17 May 2022 19:06 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/9 "2022-05-17T19:06:28Z")

</div>

```auto
[
    {
        "id": "834951a6acc15723",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "93828c487a9a0c1d",
        "type": "moment",
        "z": "834951a6acc15723",
        "name": "",
        "topic": "",
        "input": "",
        "inputType": "date",
        "inTz": "Africa/Tunis",
        "adjAmount": 0,
        "adjType": "days",
        "adjDir": "add",
        "format": "YYYY-MM-DD HH:mm:ss",
        "locale": "fr-FR",
        "output": "",
        "outputType": "msg",
        "outTz": "Africa/Tunis",
        "x": 380,
        "y": 140,
        "wires": [
            [
                "1004411dcf989289",
                "da443d2580ef62c3"
            ]
        ]
    },
    {
        "id": "1004411dcf989289",
        "type": "firebase modify",
        "z": "834951a6acc15723",
        "name": "DATA3",
        "firebaseconfig": "",
        "childpath": "DATA3",
        "method": "push",
        "value": "msg.payload",
        "priority": "msg.priority",
        "x": 590,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "da443d2580ef62c3",
        "type": "debug",
        "z": "834951a6acc15723",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 590,
        "y": 220,
        "wires": []
    },
    {
        "id": "d46ffb655c8b718a",
        "type": "s7 in",
        "z": "834951a6acc15723",
        "endpoint": "d944ccff93391236",
        "mode": "single",
        "variable": "DATA0",
        "diff": true,
        "name": "DATA0",
        "x": 150,
        "y": 140,
        "wires": [
            [
                "93828c487a9a0c1d"
            ]
        ]
    },
    {
        "id": "d944ccff93391236",
        "type": "s7 endpoint",
        "transport": "iso-on-tcp",
        "address": "192.168.1.11",
        "port": "102",
        "rack": "0",
        "slot": "1",
        "localtsaphi": "01",
        "localtsaplo": "00",
        "remotetsaphi": "01",
        "remotetsaplo": "00",
        "connmode": "rack-slot",
        "adapter": "",
        "busaddr": "2",
        "cycletime": "1000",
        "timeout": "2000",
        "name": "",
        "vartable": [
            {
                "addr": "DB1,WORD0",
                "name": "DATA0"
            }
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [18 May 2022 08:21 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/10 "2022-05-18T08:21:05Z")

</div>

I've just taken your flow and removed the nodes I don't have.  
The Date/Time Formatter produces the correct time for me, so I suspect your problem is in the first node.  
 ![Screen Shot 05-18-22 at 09.17 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/3/239d770a3601b3a7e6e92dce191302df74a903d7.png)  
 ![Screen Shot 05-18-22 at 09.18 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0f0d63e34b6eed9cd5513f709ee33334efce6ed0.png)

---

<div class="post-metadata">

**Author:** ![Zaineb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zaineb/32/61745_2.png) [@Zaineb](https://discourse.nodered.org/u/Zaineb)\
**Post date:** [18 May 2022 13:36 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/11 "2022-05-18T13:36:24Z")

</div>

The Date/Time Node works perfect but i want to send date with value.  
For exemple here i want send 23 concatinat with date like this: ''2022-05-18 14:42:00 23"

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/e/bebd739c6ca57df53ae387c068614730f4a56c7e.png)

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [18 May 2022 14:32 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/12 "2022-05-18T14:32:08Z")

</div>

OK- I understand now.

Try this...

 ![Screen Shot 05-18-22 at 03.33 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/e/1e60c71b65e320e0cf37dbfa88482b85a7954619.png)

```auto
[{"id":"93828c487a9a0c1d","type":"moment","z":"834951a6acc15723","name":"","topic":"","input":"","inputType":"date","inTz":"Africa/Tunis","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD HH:mm:ss","locale":"fr-FR","output":"date_time","outputType":"msg","outTz":"Africa/Tunis","x":320,"y":240,"wires":[["64ead62bf7b2409b"]]},{"id":"da443d2580ef62c3","type":"debug","z":"834951a6acc15723","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":240,"wires":[]},{"id":"03f1675bfde5c458","type":"inject","z":"834951a6acc15723","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"23","payloadType":"num","x":140,"y":240,"wires":[["93828c487a9a0c1d"]]},{"id":"64ead62bf7b2409b","type":"function","z":"834951a6acc15723","name":"","func":"msg.payload = msg.date_time + \" \" +msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":240,"wires":[["da443d2580ef62c3"]]}]

```

---

<div class="post-metadata">

**Author:** ![Zaineb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zaineb/32/61745_2.png) [@Zaineb](https://discourse.nodered.org/u/Zaineb)\
**Post date:** [18 May 2022 14:35 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/13 "2022-05-18T14:35:07Z")

</div>

Thank you

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [18 May 2022 14:37 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/14 "2022-05-18T14:37:57Z")

</div>

If you don't want to pass `msg.date_time` onto further nodes, you can delete with... in the function node.

```auto
msg.payload = msg.date_time + " " +msg.payload;

delete msg.date_time;

return msg;

```

---

<div class="post-metadata">

**Author:** ![Zaineb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zaineb/32/61745_2.png) [@Zaineb](https://discourse.nodered.org/u/Zaineb)\
**Post date:** [18 May 2022 14:40 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/15 "2022-05-18T14:40:20Z")

</div>

Got it , thanks.

---

<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:** [1 June 2022 14:41 UTC](https://discourse.nodered.org/t/how-display-date-value-of-sensor-in-node-red/62766/16 "2022-06-01T14:41:07Z")

</div>

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