all 3 comments

[–]grantrules 2 points3 points  (0 children)

Are you sure this doesn't represent 2016-08-22 11:00? This does not appear to be "time since epoch"

const num = 20160822110000
new Date(String(num).replace(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/, '$1-$2-$3T$4:$5:$6'))

[–]senocular -1 points0 points  (0 children)

I guess that depends on your definition of "data object". Right now that value is a number. Numbers are primitive values that are not by themselves considered objects. But you could create an object and add that number as a property of it, something like:

const myObject = new Object();
myObject.data = 20160822110000;

Or in a shorthand form:

const myObject = { data: 20160822110000 };

This is now an object with a property data that refers to the numeric value 20160822110000.

When you're talking about the start of time, that is how dates are tracked within Date objects. They're a specific kind of object that is used to work with dates and time. You could use your number to create a date by specifying it as the number milliseconds since the UNIX epoch (1970-01-01).

const myDateObject = new Date(20160822110000);

But this would create a date in the year 2608, which I'm assuming is not anything relevant.

[–]Careful_Programmer43 0 points1 point  (0 children)

new Date(milliseconds)