Is there any function or logic in javascript by which I can get my time in microseconds? I'm trying to get time asvar s = new Date();
here the minimum unit I get is Milliseconds, but how can I get this time in microseconds?
Asked
Active
Viewed 1.2k times
0

L84
- 45,514
- 58
- 177
- 257

Shilpa Soni
- 2,034
- 4
- 27
- 38
-
check this [link](http://stackoverflow.com/questions/10857272/javascript-) it may helpfull for you – Engineer Oct 11 '13 at 07:36
-
Check this link[http://stackoverflow.com/questions/6233927/microsecond-timing-in-javascript – Bhagavan Oct 11 '13 at 07:44
2 Answers
1
You can also use the new "High Resolution Time" http://www.w3.org/TR/hr-time/
Example and demo here: http://www.sitepoint.com/10-html5-apis-worth-looking/

HasanAboShally
- 18,459
- 7
- 30
- 34
1
use package microtime To install : npm install microtime
var us = require('microtime');
var us_time = us.now();

Rose
- 71
- 6
-
If you intend to use this to get the system date and time in milliseconds rather than using this for timing, this is the better answer. – waternova Aug 09 '17 at 20:35