Calculating time diffence between 2 events in homey script

you could make a Homescript and send two parameters, time1 & time2
convert them to timestamps, substract them, and than you could convert that back to time. or… use my script i posted recently, in Dutch:

var dateParts = '17-09-2013 10:08'.match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/);

console.log(dateParts); // ["17-09-2013 10:08", "17", "09", "2013", "10", "08"]

source: jquery - Converting a datetime string to timestamp in Javascript - Stack Overflow

1 Like