Hello Everyone,
I am using node-red-contrib-moment and I am using date/time formatter my problem is when i am using output as msg.payload then my original message get replaced by the time. So I want to add timestamp with my original message but I also want to change the format of time.
Please help.
Another option in addition to ukmoose's solution is to put the time to some other property like msg.time, then pass through to a template node with something along the lines of {{payload}} {{time}}outputting to msg.payload.
Without an example of a message it is difficult to advise as thats the first time you mentioned that msg.payload wasn't a string. Please give an example of your msg object now and what you want it to be.
Okay so the original message is json file whcih consits of some number like this [0,15.3596,207.2841,0,1.88446,251.91855] so this is the msg.payload right. But when I am using moment and also change node then I am confused that what will go in that change node because in change node there are two fields "set" and "to". So if i set it to msg.payload as you said earlier then what will be "to" field and how I am going to use that in function because i want to append my original message+formatted timestamp([0,15.3596,207.2841,0,1.88446,251.91855] 2019-01-18T18:35:31.253Z) i want something like this
I am wondering what ukmoose thinks to accomplish with his comment 'do your homework'.
I had the same question, googled and landed here. Just an snwer: this is how you do such stuff would have helped more people. Sometimes a maker want to make something and stumbles on a whole new world. Why do a lot of people replying in fora think they are the bigger one who have to point the noob it's place?
If your car brakes down, you expect the garage to send you to the manufacturer for a in-depth course in car mechanics? Or would it help you if he just advised yoy ti clean the spark plugs?
No, you expect to pay a significant amount of money so he/she fixes it for you. If you ask a garage for help but you are not prepared to pay then you are likely to be disappointed.
The idea here is that people learn from others. Very often the best way to learn is to be pointed in the right direction and told where to read up on something in order to be able to find a solution. If the OP had come back and said he did not understand something then further help would have been forthcoming.
If you still have a problem then it would be best to start a new thread, explaining exactly what the problem is and no doubt someone will do their best to assist.