EN
TypeScript - get UNIX timestamp in milliseconds
0
points
In this short article, we would like to show how to get unix timstamp in milliseconds in TypeScript.
Note: as unix timestamp in this article we understans bash
date +%s%3N
command result.
Quick solution:
const now: number = Date.now();
console.log(now); // Example output: 1648547761676
Reusable source code
const getTimestamp = (): number => {
return Date.now();
};
// Usage example:
const now: number = getTimestamp();
console.log(now);
Example output:
1648547787253