I have been reading about the JavaScript 'off-by-one' for dates, but I cannot figure out how to implement it in this situation. I'm converting some values from an Internet Explorer cookie into a Microsoft FILETIME, but it's always ahead by one day, the code is:
function ConvertToFiletime(high, low) {
var seconds = 1e-7 * (high * Math.pow(2, 32) + low) - 11644473600;
var date = new Date.UTC(1970,1,1);
date.setSeconds(date.getSeconds() + seconds);
return date;
}
This does the conversion perfectly well, but I can't work out the best way to deal with the extra day, which I believe is due to a lack of a timezone. Do I need to subtract a day's worth of seconds? Or is there a better way.