My scenario is to convert the data of milliseconds to a date format. I have tried a lot as here http://jsbin.com/jeququ/1/ but it is only working for a limited milliseconds value, and fails if the value is high. I am looking to replicate the functionality as http://www.ruddwire.com/handy-code/date-to-millisecond-calculators/#.VJAp9lWUe1R
Milliseconds Since : Thu Jan 01 1970 05:30:00 GMT+0530
getTime() The getTime() method returns the number of milliseconds since the ECMAScript epoch. You can use this method to help assign a date and time to another Date object.
JavaScript Date getTime()getTime() returns the number of milliseconds since January 1, 1970 00:00:00.
If you need milliseconds, you need to add a further multiplication / division by 1000. For example, converting from epoch time (milliseconds) to a date would be "=((((A1/1000)/60)/60)/24)+DATE(1970,1,1)".
This should work:
var d = new Date(milliseconds);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With