Krittapon's github web
// Convert the payload to a String object
msg.payload = new Date(msg.payload).toString();
return msg;
[
{
"id": "fc0e24ce8c0e468f",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "cde591e8dd803624",
"type": "inject",
"z": "fc0e24ce8c0e468f",
"name": "Timer",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "5",
"crontab": "",
"once": true,
"onceDelay": "0",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 180,
"wires": [
[
"de9e552a57dcb5e4"
]
]
},
{
"id": "2dfe0bb901316a30",
"type": "debug",
"z": "fc0e24ce8c0e468f",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 460,
"y": 340,
"wires": []
},
{
"id": "a461a0248c86f96d",
"type": "mqtt in",
"z": "fc0e24ce8c0e468f",
"name": "Subscriber",
"topic": "test/1234/#",
"qos": "2",
"datatype": "auto-detect",
"broker": "373c28f3ff7a7b84",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 240,
"y": 340,
"wires": [
[
"2dfe0bb901316a30"
]
]
},
{
"id": "6d5e8f76655688e4",
"type": "mqtt out",
"z": "fc0e24ce8c0e468f",
"name": "Publisher",
"topic": "test/1234/msg",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "373c28f3ff7a7b84",
"x": 660,
"y": 180,
"wires": []
},
{
"id": "de9e552a57dcb5e4",
"type": "function",
"z": "fc0e24ce8c0e468f",
"name": "function ConvDateString",
"func": "// Convert the payload to a String object\nmsg.payload = new Date(msg.payload).toString();\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 390,
"y": 180,
"wires": [
[
"6d5e8f76655688e4"
]
]
},
{
"id": "373c28f3ff7a7b84",
"type": "mqtt-broker",
"name": "Mosquitto",
"broker": "localhost",
"port": "1883",
"clientid": "nodered_demo",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]