I’m writing a Javascript application and when I query the docker images API endpoint I get all the expected data back but the “created” field either appears to be wrong, or I’m not understanding it.
I want to show the date that it was created so I am getting the current date in milliseconds and then taking away the creation date.
My expected end result should be the correct date but it appears to be off by a lot (see example below).
Has anyone else seen this behaviour with the “created” field in the docker images API?
Am I being stupid and misunderstanding what data I’m receiving from the "created " field?
Example with an image created 10 minutes ago (26 Feb)
var d = new Date();
var x = d.getTime();
var y = 1519679476;
var n = x-y;
var dateString = new Date(n);
console.log(dateString);
Output:
Fri Feb 09 2018 07:35:25 GMT+0000 (GMT)