Sometimes, we want to convert JavaScript date object to ticks.
In this article, we’ll look at how to convert JavaScript date object to ticks.
How to convert JavaScript date object to ticks?
To convert JavaScript date object to ticks, we can use the date’s getTime
method.
For instance, we write
const ticks = new Date().getTime();
to create a date object and call its getTime
method to return the Unix timestamp of the datetime in milliseconds.
Conclusion
To convert JavaScript date object to ticks, we can use the date’s getTime
method.