- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Timestamps
JavaScript Dates
JavaScript Timestamps
A timestamp is the number of milliseconds since the start of 1970.
That moment is called the Unix epoch.
Storing a timestamp avoids every timezone and formatting question.
Example
Example
javascript
const timestamp = Date.now();
console.log(typeof timestamp);
console.log(timestamp > 0);The value changes constantly, so the checks are what matter.
Working with Timestamps
Date.now() gives the current timestamp.
