I'm attempting to insert some information in an object into a database. The object is a Stripe object (they process payments). That doesn't really matter; what matters is how they provide the server the 'date' a payment is/was made. They provide it in milliseconds like this:
{
"created": 1489458464
}
That's supposed to be the time in milliseconds since January 1, 1970, 00:00:00 UTC... but its missing the last 3 digits.
So when I want to convert this to a readable time, I simply add 3 zeros to the end like this:
var date = 1489458464000;
var date2 = new Date(date);
console.log(date2.toString());
//Output: Mon Mar 13 2017 22:27:44 GMT-0400 (Eastern Daylight Time)
This seems like an acceptable solution to this problem; the last 3 digits don't seem to change the date/time.
I just want to confirm whether this is okay, or if someone thinks I should be doing something else. Thanks.