Convert date and time to numeric value in JavaScript

3

I saw in kibana , the dates are treated as numeric values, for example, the date: 2016-05-03T10:00:00 is equal to the numeric value: 1462280400000 . I would like to understand how this works, and what function it can convert.

    
asked by anonymous 03.05.2016 / 15:26

1 answer

3

This is probably timestamp which is the number of seconds since a specific date ( 1970-01-01 00:00:00 UTC ), so it can not represent any date. If this is what you want there, just use the getTime() .

data = new Date(2016, 04, 03, 10, 30);
document.body.innerHTML += data.getTime()
    
03.05.2016 / 15:30