Introduction
In JavaScript, we may wish to get a timestamp in seconds.
We'll examine how to get a timestamp in seconds in this tutorial.
How to get a timestamp in seconds in JavaScript
To get the number of seconds since the Unix epoch use the following method:
Conclusion
To get a timestamp in seconds in JavaScript we can use Date.now()
and divide its value by a thousand.
To get timestamp in milliseconds simply use Date.now()
static method.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}