Google Excel Time Difference
function TimeDiff(cell1, cell2) {
return ConvertMilliSecondsToTimeSpan(Math.abs(cell1 - cell2));
}
function ConvertMilliSecondsToTimeSpan(t) {
var cd = 24 * 60 * 60 * 1000,
ch = 60 * 60 * 1000,
d = Math.floor(t / cd),
h = '0' + Math.floor((t - d * cd) / ch),
m = '0' + Math.round((t - d * cd - h * ch) / 60000);
return [h.substr(-2), m.substr(-2), '00'].join(':');
}
How to use it
1/1/2014 21:00:00 | 2/1/2014 1:15:00 |
function usage
=TimeDiff(E24,F24)