How do I convert MySQL TIMESTAMP to UK date/time format?

Setup a Pi sending cpu temperature readings, stored in MySQL.

I have an SQL SELECT in a function node which is pulling in an array of objects.
I have got the temperature out of the object and showing on a node-red dashboard.

What I cannot find how to do, is to reformat the time and date from.......

2022-11-10T22:13:03.000Z

....to 22:13 11/10/2022

Hope someone can help,
Thank you.

You can us the angularjs date format in the ui value fields
{{msg.payload | date : "HH:mm: dd-MM-yyyy" }}
e.g.

[{"id":"97f4b5a1cfbfe0f5","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2022-11-10T22:13:03.000Z","payloadType":"str","x":430,"y":4160,"wires":[["910bbd4af90b27c5"]]},{"id":"910bbd4af90b27c5","type":"ui_text","z":"452103ea51141731","group":"2d4fe667.28f8ba","order":18,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload | date : \"HH:mm: dd-MM-yyyy\" }}","layout":"row-spread","className":"","x":590,"y":4160,"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}]
1 Like

I see, so we're using our own timestamp, ignoring that from the SQL Select. Clever!
I'll have a play later, thank you.

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