Hi!
Im using a function node to set a time stamp. What I would like is to be able to manipulate the timestamp. Etc adding a hour.
"
new_msg = {
payload: {
ontime: msg.payload.substr(0,5),
offtime: msg.payload.substr(0,5)
}
}
return new_msg;
"
This returns this:
object
ontime: "13:00"
offtime: "13:00"
Ideas on how to do that with the function node?
You will be much better off using Javascript's Date functions.
That might be:).
Could you point me in the right direction?
MDN is always the best place to start looking for JavaScript reference info:
I use it all the time as I can never remeber the exact parameters for things.
You need to create a Date variable - looks like you have an input date string - depending on the format of that and your locale, you should be able to use it as input to the Date function. From there on, it is all math