I was playing around with JavaScript dates and I\’m looking for an explanation pertaining to the last logged array. Why are the numbers 1352589000, 1352589395 different?
Code
var examples = [
\"Fri Jan 16 1970 10:43:09 GMT-0500 (EST)\",
1352589395
];
var text = [
new Date((examples[0])),
new Date((examples[1])),
];
var unix = [
new Date((examples[0])).getTime(),
new Date((examples[1])).getTime(),
];
console.log(examples);
console.log(text);
console.log(unix);
Output
[
\'Fri Jan 16 1970 10:43:09 GMT-0500 (EST)\',
1352589395
][
\'Fri Jan 16 1970 10:43:09 GMT-0500 (EST)\' ,
\'Fri Jan 16 1970 10:43:09 GMT-0500 (EST)\'
][
1352589000,
1352589395
]





Rating:
The post javascript – Timestamp Inconsistency appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/javascript-timestamp-inconsistency.html
No comments:
Post a Comment