Function Node string to time

I have a function node that takes a date and compares it to the system date. ( found the code on the internet). It produces a string like “05:12:00”. that shows the difference between the times. I use this code:

let LastCon = msg.payload.last_seen;
let SrvCon = Date.now() - LastCon;
msg.payload = new Date(SrvCon).toUTCString().split(" ")[4];
return msg;

I’m trying to tweak the code to give it as a time, not a string, so I can set a node to pass information if it is more than 48 hours from the original date. Any ideas or help?

1 Like

I figured this out. Seems that Json auto-converts the string of numbers. Just setting up a < or > work with conversion

2 Likes