Node-SMB / marsaud-smb2

SMB2 Client
53 stars 46 forks source link

Decode datetime values #58

Open mogadanez opened 4 years ago

mogadanez commented 4 years ago

trying to do same as EndOfFile

            for (var i = 0; i < v.length; i++) {
                val += v[i] * Math.pow(2, i * 8);
            }

got "CreationTime": 132221877448853630 which is not valid timestamp

in which format it is transfered

julien-f commented 4 years ago

No idea, please take a look at the specification: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/5606ad47-5ee0-437a-817e-70c366052962

sachinraste commented 4 years ago
function convert(time){
  var winTicks = 10000000;
  var uEpoch = 11644473600;

  var unixTime = time/winTicks - uEpoch;
  console.log(unixTime);
  var utc = new Date(unixTime * 1000).toUTCString();
  console.log("utc",utc)
}
convert(132291632112018540)