FILETIME to UNIX time in JavaScript

If you ever need to convert FILETIME to good old UNIX time in JavaScript, then this is what you need:

var filetime_to_unixtime = function(ft) {
    epoch_diff = 116444736000000000;
    rate_diff = 10000000;
    return parseInt((ft - epoch_diff)/rate_diff);
}

var filetime_as_string = function(ft) {
    var ut = filetime_to_unixtime(ft);
    var d = new Date(ut * 1000);
    return d.toLocaleString();
}