Time formating convert


Still a newbie to node red :slight_smile:

i maneged to get my PLC time function to work with the help of this topic:

So now i can read the time value from my PLC
The code for function block is:

var asHex = parseInt(msg.payload).toString("16").padStart(4, "0");
var hh = asHex.substring(0, 2);
var mm = asHex.substring(2, 4);
msg.payload = `${hh}:${mm}`
return msg;

But can someone help me re-write the function code so i can send / edit the time value in PLC ?

Node-red-contrib-moment provides a node that easily formats time into any form you want. If you are looking specifically how to send time to plc someone else will have weigh in.

1 Like

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