How do I get the current timestamp in terminal?

How do I get the current timestamp in terminal?
Answer
On UNIX-like machines, which include Linux and macOS, you can type date +%s in the terminal and get the UNIX timestamp back:
  1. $ date +%s 1524379940.
  2. Date. now()
  3. new Date(). getTime() or new Date(). valueOf()
  4. Math. floor(Date. now() / 1000)
  5. ~~(Date. now() / 1000)
  6. +new Date.
 

Tìm kiếm

Back
Top