# DIsplay UNIX time from a node in yyyy-MM-dd HH:mm format on a Dashboard

**URL:** <https://discourse.nodered.org/t/display-unix-time-from-a-node-in-yyyy-mm-dd-hh-mm-format-on-a-dashboard/75619>\
**Category:** Dashboard\
**Tags:** node-red-dashboard\
**Created:** [23 February 2023 09:00 UTC](https://discourse.nodered.org/t/display-unix-time-from-a-node-in-yyyy-mm-dd-hh-mm-format-on-a-dashboard/75619 "2023-02-23T09:00:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fritserasmus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fritserasmus/32/274_2.png) [@fritserasmus](https://discourse.nodered.org/u/fritserasmus)\
**Post date:** [23 February 2023 09:00 UTC](https://discourse.nodered.org/t/display-unix-time-from-a-node-in-yyyy-mm-dd-hh-mm-format-on-a-dashboard/75619/1 "2023-02-23T09:00:02Z")

</div>

I am receiving a date from openeathermap in Unix format and I would like to display the date in a dashboard in the yyyy-MM-dd HH:mm format.

What I did:

Set up a timestamp inject node to trigger the read:

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

I use an edit change node to change the message for temperatures that work perfect for me:

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

I then tried to do the same with sunrise time:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/5/15d6ad0af3a3be9fb9fa15a073693e7165013437.png)

I no receive the Unix time on my dashboard:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/3/33d9e9daccd164635764c5015a6e689ab7c99e95.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/9/29d7a089bdbb4d8a2c707a75a7fcde6cc8991892.png)

As a NON-DEVELOPER I tried my best to understand this:

> **[AngularJS](https://docs.angularjs.org/api/ng/filter/date)**
>
> AngularJS is what HTML would have been, had it been designed for building web-apps.
> Declarative templates with data-binding, MVC, dependency injection and great
> testability story all implemented with pure client-side...

and tried this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cfb6026b657d472da117e779270c8b9da60613a5.png)

and NO sunrise date / time is showing.

I need some help to fix this, Please

---

<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:** [23 February 2023 09:11 UTC](https://discourse.nodered.org/t/display-unix-time-from-a-node-in-yyyy-mm-dd-hh-mm-format-on-a-dashboard/75619/2 "2023-02-23T09:11:52Z")

</div>

You can format the date with angularjs filters in the ui nodes just times by 1000. You don't need to move the values to payload.  
e.g.  
Value format field

```auto
{{msg.payload.sys.sunrise * 1000 | date : "yyyy-MM-dd HH:mm"}}

```

```auto
[{"id":"e9c46733dde4fe28","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload.sys.sunrise","v":"1677143063","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":4740,"wires":[["ab40d4ca63acfdd9","2b6ccc1aa23dd831"]]},{"id":"ab40d4ca63acfdd9","type":"debug","z":"452103ea51141731","name":"debug 234","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":4720,"wires":[]},{"id":"2b6ccc1aa23dd831","type":"ui_text","z":"452103ea51141731","group":"2d4fe667.28f8ba","order":19,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload.sys.sunrise * 1000 | date : \"yyyy-MM-dd HH:mm\"}}","layout":"row-spread","className":"","x":290,"y":4760,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":2,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

> **[AngularJS](https://docs.angularjs.org/api/ng/filter/date#)**
>
> AngularJS is what HTML would have been, had it been designed for building web-apps.
> Declarative templates with data-binding, MVC, dependency injection and great
> testability story all implemented with pure client-side...

---

<div class="post-metadata">

**Author:** ![fritserasmus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fritserasmus/32/274_2.png) [@fritserasmus](https://discourse.nodered.org/u/fritserasmus)\
**Post date:** [23 February 2023 09:25 UTC](https://discourse.nodered.org/t/display-unix-time-from-a-node-in-yyyy-mm-dd-hh-mm-format-on-a-dashboard/75619/3 "2023-02-23T09:25:52Z")

</div>

Sorry @E1cid ,

It is not working for me:

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/3/433f49998c644ea13773bd37bdaac81aba96fee2.png)

Did I perhaps include / exclude brackets or spaces?

---

<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:** [23 February 2023 09:27 UTC](https://discourse.nodered.org/t/display-unix-time-from-a-node-in-yyyy-mm-dd-hh-mm-format-on-a-dashboard/75619/4 "2023-02-23T09:27:37Z")

</div>

Have you moved the values in the change nodes? if so don't.

Also please supply your incoming JSON from openweather in a copyable form.

---

<div class="post-metadata">

**Author:** ![fritserasmus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fritserasmus/32/274_2.png) [@fritserasmus](https://discourse.nodered.org/u/fritserasmus)\
**Post date:** [23 February 2023 11:39 UTC](https://discourse.nodered.org/t/display-unix-time-from-a-node-in-yyyy-mm-dd-hh-mm-format-on-a-dashboard/75619/5 "2023-02-23T11:39:11Z")

</div>

This is my node:-

```auto
[{"id":"406768ea.130408","type":"inject","z":"90ad4c26.ecec5","name":"","topic":"Midstream Weather","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":1820,"wires":[["3f4b7628.05aaea"]]},{"id":"3f4b7628.05aaea","type":"http request","z":"90ad4c26.ecec5","name":"Midstream","method":"GET","ret":"obj","paytoqs":false,"url":"https://api.openweathermap.org/data/2.5/weather?lat=-25.9964&lon=28.2268&appid=8180814af046016d40fbc9ddce00b19d&units=metric","tls":"","persist":false,"proxy":"","authType":"","x":430,"y":1820,"wires":[["9a394ee.15c7db","769a34c4.92088c","9ff88257.65b56","8129ddb8.e16c7","65366610.0e1b98","a974154f.32c9b8"]]},{"id":"9a394ee.15c7db","type":"debug","z":"90ad4c26.ecec5","name":"","active":false,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","x":850,"y":1820,"wires":[]},{"id":"6b2c6abc.1df994","type":"comment","z":"90ad4c26.ecec5","name":"Weather call","info":"","x":1050,"y":1860,"wires":[]},{"id":"65366610.0e1b98","type":"change","z":"90ad4c26.ecec5","name":"Sunrise","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.sys.sunrise","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":2100,"wires":[["9799b2b8.1fb64","ebcb5af7.399168","f9a48354.b8ef2"]]},{"id":"a974154f.32c9b8","type":"change","z":"90ad4c26.ecec5","name":"Sunset","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.sys.sunset","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":2201,"wires":[["8307dd7c.51c3c","b836b9a4.59ea28"]]},{"id":"9799b2b8.1fb64","type":"debug","z":"90ad4c26.ecec5","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":1570,"y":2100,"wires":[]},{"id":"8307dd7c.51c3c","type":"debug","z":"90ad4c26.ecec5","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":1570,"y":2201,"wires":[]},{"id":"769a34c4.92088c","type":"change","z":"90ad4c26.ecec5","name":"Current Temp","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.main.temp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":1940,"wires":[["c2e03a6f.3871c8","90fbddad.3239"]]},{"id":"c2e03a6f.3871c8","type":"debug","z":"90ad4c26.ecec5","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":1570,"y":1940,"wires":[]},{"id":"9ff88257.65b56","type":"change","z":"90ad4c26.ecec5","name":"Min Temp","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.main.temp_min","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1980,"wires":[["8b109f2b.f88e7","11ad7a9a.a736c5"]]},{"id":"8129ddb8.e16c7","type":"change","z":"90ad4c26.ecec5","name":"Max Temp","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.main.temp_max","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":2020,"wires":[["cd8afb8f.99ed48","81f4c601.c24e68"]]},{"id":"8b109f2b.f88e7","type":"debug","z":"90ad4c26.ecec5","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":1570,"y":1980,"wires":[]},{"id":"cd8afb8f.99ed48","type":"debug","z":"90ad4c26.ecec5","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":1570,"y":2020,"wires":[]},{"id":"90fbddad.3239","type":"ui_text","z":"90ad4c26.ecec5","group":"b89e7b15.bc4868","order":0,"width":0,"height":0,"name":"","label":"Current Temp","format":"{{msg.payload}}","layout":"row-spread","className":"","x":900,"y":1920,"wires":[]},{"id":"11ad7a9a.a736c5","type":"ui_text","z":"90ad4c26.ecec5","group":"b89e7b15.bc4868","order":1,"width":0,"height":0,"name":"","label":"Min Temp","format":"{{msg.payload}}","layout":"row-spread","className":"","x":880,"y":1960,"wires":[]},{"id":"81f4c601.c24e68","type":"ui_text","z":"90ad4c26.ecec5","group":"b89e7b15.bc4868","order":2,"width":0,"height":0,"name":"","label":"Max Temp","format":"{{msg.payload}}","layout":"row-spread","className":"","x":890,"y":2000,"wires":[]},{"id":"ebcb5af7.399168","type":"ui_text","z":"90ad4c26.ecec5","group":"b89e7b15.bc4868","order":3,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","className":"","x":870,"y":2080,"wires":[]},{"id":"b836b9a4.59ea28","type":"ui_text","z":"90ad4c26.ecec5","group":"b89e7b15.bc4868","order":4,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","className":"","x":870,"y":2181,"wires":[]},{"id":"f9a48354.b8ef2","type":"ui_text","z":"90ad4c26.ecec5","group":"b89e7b15.bc4868","order":5,"width":0,"height":0,"name":"Sunrise 2","label":"Sunrise 2","format":"{{msg.payload.sys.sunrise * 1000 | date : \"yyyy-MM-dd HH:mm\"}}","layout":"row-spread","className":"","x":880,"y":2120,"wires":[]},{"id":"b89e7b15.bc4868","type":"ui_group","z":"","name":"Test2","tab":"f7d5b107.3e578","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"f7d5b107.3e578","type":"ui_tab","z":"","name":"Test2","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<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:** [23 February 2023 11:48 UTC](https://discourse.nodered.org/t/display-unix-time-from-a-node-in-yyyy-mm-dd-hh-mm-format-on-a-dashboard/75619/6 "2023-02-23T11:48:18Z")

</div>

I never asked for your flow, i asked for the output JSON of the openweather node.

As said before do not move/set `msg.payload.sys.sunrise` to `msg.payload`, as it overwrites payload.

To be clear, remove the change node.

Ps. you have added you api key and it is clear to view from the internet, either change your api key or edit your post.

[edit]  
Working here for me i have removed api key in this example flow.

```auto
[{"id":"406768ea.130408","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"Midstream Weather","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Midstream Weather","payload":"","payloadType":"date","x":160,"y":4600,"wires":[["d19524e9774de766"]]},{"id":"d19524e9774de766","type":"http request","z":"452103ea51141731","name":"Midstream","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.openweathermap.org/data/2.5/weather?lat=-25.9964&lon=28.2268&appid=[add_api_key]&units=metric","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"credentials":{},"x":250,"y":4660,"wires":[["2b6ccc1aa23dd831"]]},{"id":"2b6ccc1aa23dd831","type":"ui_text","z":"452103ea51141731","group":"2d4fe667.28f8ba","order":19,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload.sys.sunrise * 1000 | date : \"yyyy-MM-dd HH:mm\"}}","layout":"row-spread","className":"","x":410,"y":4660,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":2,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

In fact you should present the flow with the least nodes that shows your issue, i would of presented just two or three nodes like this

```auto
[{"id":"2b6ccc1aa23dd831","type":"ui_text","z":"452103ea51141731","group":"2d4fe667.28f8ba","order":19,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload.sys.sunrise * 1000 | date : \"yyyy-MM-dd HH:mm\"}}","layout":"row-spread","className":"","x":410,"y":4660,"wires":[]},{"id":"406768ea.130408","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Midstream Weather","payload":"{\"coord\":{\"lon\":28.2268,\"lat\":-25.9964},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01d\"}],\"base\":\"stations\",\"main\":{\"temp\":27.26,\"feels_like\":27.95,\"temp_min\":24.62,\"temp_max\":30.16,\"pressure\":1014,\"humidity\":54,\"sea_level\":1014,\"grnd_level\":851},\"visibility\":10000,\"wind\":{\"speed\":3.04,\"deg\":96,\"gust\":3.69},\"clouds\":{\"all\":0},\"dt\":1677153144,\"sys\":{\"type\":2,\"id\":2037341,\"country\":\"ZA\",\"sunrise\":1677124635,\"sunset\":1677170648},\"timezone\":7200,\"id\":949880,\"name\":\"Tembisa\",\"cod\":200}","payloadType":"json","x":230,"y":4660,"wires":[["2b6ccc1aa23dd831"]]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":2,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

All info is there and there is no confusion as to what nodes have the issue.

---

<div class="post-metadata">

**Author:** ![fritserasmus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fritserasmus/32/274_2.png) [@fritserasmus](https://discourse.nodered.org/u/fritserasmus)\
**Post date:** [23 February 2023 12:11 UTC](https://discourse.nodered.org/t/display-unix-time-from-a-node-in-yyyy-mm-dd-hh-mm-format-on-a-dashboard/75619/7 "2023-02-23T12:11:07Z")

</div>

I have shared a temporary API so I will just delete it now

I think I am still on a very old ver ☺

---

<div class="post-metadata">

**Author:** ![fritserasmus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fritserasmus/32/274_2.png) [@fritserasmus](https://discourse.nodered.org/u/fritserasmus)\
**Post date:** [24 February 2023 05:49 UTC](https://discourse.nodered.org/t/display-unix-time-from-a-node-in-yyyy-mm-dd-hh-mm-format-on-a-dashboard/75619/8 "2023-02-24T05:49:10Z")

</div>

Thank you @E1cid for taking the time to guide me in doing my flows in the correct way.  
I appreciate it very much!

I have now updated my Node-RED to the latest and suddenly things are much easier to do.

My dashboard is coming on nicely now!

I will be adding some extra nodes to the dashboard as the further it grows the more useful things I identify I should add.

Thanks for helping me to achieve my goal.

---

<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:** [26 March 2023 05:49 UTC](https://discourse.nodered.org/t/display-unix-time-from-a-node-in-yyyy-mm-dd-hh-mm-format-on-a-dashboard/75619/9 "2023-03-26T05:49:37Z")

</div>

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