How to format the timestamps
Sometimes you need to use the timestamps in your Node-RED project. You can use the timestamp node to extract the timestamp like below:

Source code
[
{
"id": "3c9e9659a9a48e65",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "82ae8f7a87f62c48",
"type": "inject",
"z": "3c9e9659a9a48e65",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 80,
"wires": [
[
"6e27c4f9b4be2f8f"
]
]
},
{
"id": "853dbe45d82473a8",
"type": "debug",
"z": "3c9e9659a9a48e65",
"name": "debug 3",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 780,
"y": 80,
"wires": []
},
{
"id": "6e27c4f9b4be2f8f",
"type": "change",
"z": "3c9e9659a9a48e65",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$now()",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 360,
"y": 80,
"wires": [
[
"71738532703c5a2c"
]
]
},
{
"id": "71738532703c5a2c",
"type": "function",
"z": "3c9e9659a9a48e65",
"name": "Optimizing String",
"func": "msg.payload = msg.payload.substr(0, 10) + \" \" + msg.payload.substr(12, 7);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 590,
"y": 80,
"wires": [
[
"853dbe45d82473a8"
]
]
}
]Last updated
Was this helpful?