Using date-fns-tz additional module

Built in moment can do this in a change node.

Alternatively in a function node with


const d = new Date(msg.payload)
msg.payload = {}

// Get UTC ms since epoch
msg.payload.ts= d.valueOf()

// Get iso time
msg.payload.iso = d.toISOString()

return msg

(Assumes the time to convert is in msg.payload)

Ref: Date.prototype.toISOString() - JavaScript | MDN

I assume you mean an iso string because I associate timestamp with the numeric Epoch in JavaScript.