Howdy,
Loving Node-Red and that I have a dashboard table pulling from a DB using only 2 lines of code.
I grab sensor data from various ESP32 nodes via MQTT and stick them in a MariaDB.
I have Node Red running on a Rasberry PI V1.2.6
Time is stored as a standard Linux TimeStamp format in the DB.
Simple table and phpmyadmin displays it as:
TimeStamp Source Topic DataValue
2021-01-28 15:00:29 frontdoor temperature 31
- many rows.
Note that phpmyadmin converts the TimeStamp to my TimeZone for an easy to read format.
Then in node-red function node I have:
msg.topic = 'Select * FROM sensors ORDER BY TIMESTAMP DESC LIMIT 12;';
return msg;
I connect this function node to a mysql node then to the UI_Table and all works great and
was very simple/clean. Display is just like the table above except the TimeStamp is displayed in UTC which is hard to read. ie. 2021-01-28T20:53:30.00Z
Is there an easy way in this stream to convert the Timestamp to display using my TimeZone NY.
This is what is fed to the table:
array[12]
[0 … 9]
0: object
TimeStamp: "2021-01-28T21:32:31.000Z"
Source: "frontdoor"
Topic: "temperature"
DataValue: 28
1: object
TimeStamp: "2021-01-28T21:31:31.000Z"
Source: "frontdoor"
Topic: "temperature"
DataValue: 28
Thanks,
-steve