Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 519 Bytes

get-the-current-timestamp.md

File metadata and controls

21 lines (16 loc) · 519 Bytes
title category date topics
Get the current timestamp
Tip
2021-02-27 16:43:00 +7
JavaScript

There are a few ways to get the current timestamp. All method return the number of milliseconds:

new Date().getTime();

Date.now();

// These method are the same
// The unary operator (`+`) calls the `valueOf` method automatically
+new Date();
new Date().valueOf();

Take a look at this snippet if you want to get the current time in seconds