You could also use node-red-contrib-moment
. Here is an example with two dates being inject in the same msg and two copies of the moment node changing the format:
and here is the flow:
[{"id":"dc5af5ba.bb9b6","type":"inject","z":"89bb7ba2.1f442","name":"","topic":"","payload":"{\"date1\":\"01/01/2018 05:05\",\"date2\":\"04/01/2018 15:56\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":60,"wires":[["1683539b.69c5ac","aad6e4b1.1bc4a8"]]},{"id":"1683539b.69c5ac","type":"debug","z":"89bb7ba2.1f442","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":290,"y":120,"wires":[]},{"id":"aad6e4b1.1bc4a8","type":"moment","z":"89bb7ba2.1f442","name":"","topic":"","input":"payload.date1","inputType":"msg","inTz":"America/New_York","adjAmount":0,"adjType":"days","adjDir":"add","format":"","locale":"en_US","output":"payload.date1n","outputType":"msg","outTz":"America/New_York","x":320,"y":60,"wires":[["6ebdd87f.2614c8"]]},{"id":"6ebdd87f.2614c8","type":"moment","z":"89bb7ba2.1f442","name":"","topic":"","input":"payload.date2","inputType":"msg","inTz":"America/New_York","adjAmount":0,"adjType":"days","adjDir":"add","format":"","locale":"en_US","output":"payload.date2n","outputType":"msg","outTz":"America/New_York","x":560,"y":60,"wires":[["a6e3c74a.183b1"]]},{"id":"a6e3c74a.183b1","type":"debug","z":"89bb7ba2.1f442","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":60,"wires":[]}]