Sometimes, we want to get an accurate timestamp in Node.js.
In this article, we’ll look at how to get an accurate timestamp in Node.js.
How to get an accurate timestamp in Node.js?
To get an accurate timestamp in Node.js, we can use the process.hrtime.bigint
method.
For instance, we write
process.hrtime.bigint()
to call process.hrtime.bigint
to return the current timestamp in nanoseconds as a JavaScript bigint.
Conclusion
To get an accurate timestamp in Node.js, we can use the process.hrtime.bigint
method.