javascript - convert Millisecond to Date and Date to Millisecond -


i want convert date millisecond per follow converted.

var d = new date(1454911465467) \\ output : mon feb 08 2016 11:34:25 gmt+0530 (ist)

now want convert using output millisecond.

var d = new date('mon feb 08 2016 11:34:25 gmt+0530 (ist)').gettime() \\output : 1454911465000

expected output : 1454911465467

is way convert these type of millisecond?

milliseconds not specified in 'mon feb 08 2016 11:34:25 gmt+0530 (ist)'. date precision here down seconds. hence 467 milliseconds missed in second result.

you can check e.g.

var originaldate = new date(1454911465467);  var clonneddate = new date(originaldate.getfullyear(), originaldate.getmonth(), originaldate.getdate(), originaldate.gethours(), originaldate.getminutes(), originaldate.getseconds(), originaldate.getmilliseconds());  document.write(clonneddate.gettime());


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -