So from: https://www.epochconverter.com/
the value 1554625504
in epoch SECONDS represents GMT: Sunday, April 7, 2019 8:25:04 AM
(I imagine that is what you are going for)
and perhaps you would like to add two hours (hence the 7200,000?)
to get that in your node-red function node (javascript) you can do:
var string_lastseen = "1554625504";
var lastseen = 7200000+Number(string_lastseen)*1000;//convert from seconds to milliseconds
and add 2 hours
msg.payload = (new Date(lastseen)).toUTCString();
return msg;
Is that sort of what you are going for?
Here is the snippet:
[
{
"id": "d0d30a38.451ae8",
"type": "tab",
"label": "Temp",
"disabled": false,
"info": ""
},
{
"id": "943a111f.ec936",
"type": "inject",
"z": "d0d30a38.451ae8",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 100,
"y": 160,
"wires": [
[
"b3d73c8e.3c21"
]
]
},
{
"id": "db9500c2.5a57b",
"type": "debug",
"z": "d0d30a38.451ae8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 490,
"y": 160,
"wires": []
},
{
"id": "b3d73c8e.3c21",
"type": "function",
"z": "d0d30a38.451ae8",
"name": "",
"func": "var string_lastseen = \"1554625504\";\nvar lastseen = 7200000+Number(string_lastseen)*1000;//convert from seconds to milliseconds and add 2 hours\nmsg.payload = (new Date(lastseen)).toUTCString();\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 290,
"y": 160,
"wires": [
[
"db9500c2.5a57b"
]
]
}
]