Mid-point between two dates

Viewed 7571

What is the most efficient and syntactically elegant way to determine the half way point between two dates in Javascript.

var difference = date2.getTime() - date1.getTime();
var midpoint = new Date(date1.getTime() + difference / 2);

Is this a good approach?

1 Answers
Related