Q:

Accurately calculate days between two dates (including time)

I'm working on a front-end app, and was trying to calculate number of days between two dates, and the more I read on proper/accurate way of working out the days between two dates, the more I got confused.
So I thought, I shall post another question on here to finally shed some light on this confusion. 
Also I was trying to workout when it would be safest to do the calculation; is it when I get the raw UTC date I get from the backend below, after they're converted to Locale date and time? What I mean by this, would it be better to get the diff between UTC dates or diff between Locale date and time?
Here are UTC dates:
UTC Date 1:  2014-11-30T15:41:51.012+0000
UTC Date 2:  2014-01-09T02:56:36.000+0000

Here are Locale dates (On Windows; this will be diff format on Linux):
Locale Date 1:  11/30/2014, 3:41:51 PM
Locale Date 2:  1/9/2014, 2:56:36 AM

So my questions are, which one of those would give accurate daysBetweenDates, UTC or Locale? Also how is this calculated, a JavaScript function snippet or demo would help me and others. 
Thanks!

A:

This is how you would do it with pure JS:
var Date1 = new Date('2014-11-30T15:41:51.012+0000'.substr(0,10)).getTime();
var Date2 = new Date('2014-01-09T02:56:36.000+0000'.substr(0,10)).getTime();
var Diff = Math.floor(Math.max(Date1,Date2)-Math.min(Date1,Date2))/1000/60/60/24;

