This is based on Computing milliseconds since 1970 in C# yields different date than JavaScript and C# version of Javascript Date.getTime().
For all of these calculation
I understand that JavaScript Date objects are based on the Unix Epoch (Midnight on Jan 1, 1970).
Yes, they are. Internally, it's just a number of milliseconds from the epoch. But when you call the date constructor, or look at the output from .toString()
, it is using the local time of where the code is running.
If you want the input to be specified in UTC, then you have to use a different incantation:
var ts = Date.UTC(2014,1,28); // returns a numeric timestamp, not a Date object
var dt = new Date(ts); // if you want a date object
var s = dt.toUTCString(); // if you want the output to be in UTC