i am working with dates and got some confusing behaviour
>console.log(new Date(getTime()).toString());
Sun Jan 18 1970 00:24:12 GMT+0000
>console.log(new Date().toString());
Wed Aug 3 2016 19:29:50 GMT+0000
i expected to be able to create a new Date with the value from getTime()
getTime() returns a floating point number, but with rounding Math.round(getTime()); the result does not change
Is there some error in my code or my expectations, maybe some misinterpretation of the docs on my side?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
i am working with dates and got some confusing behaviour
i expected to be able to create a new
Date
with the valuefrom getTime()
getTime() returns a floating point number, but with rounding
Math.round(getTime());
the result does not changeIs there some error in my code or my expectations, maybe some misinterpretation of the docs on my side?