Having looked at the forums for solutions, based on these posts I created this Function node to add a Date & Time to a payload.
I thought that by adding it here, others can adapt it to suit their own needed.
You can set the timezone Use or ignore the part in the msg.date
This sample contains
An inject node to trigger, with msg.payload and msg.topic
A function node creates a DateTime value and adds it via msg.date
A function node compiles
- msg.topic
- msg.payload
- msg.date into a msg.payload
Debug node to show the resulting msg.payload
#####Day names are in English, but easy to adapt to any language in the Switch section
There was a small typo in the DateTime function Switch for adding the day name.
That has been corrected in this Gist