Date.now()

ES5+

Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.

Syntax

Date.now()

Return Value

number

A number representing the milliseconds elapsed since the UNIX epoch

Examples

JavaScript
console.log(Date.now());
// 성능 측정에 유용
const start = Date.now();
// ... 작업 수행
const end = Date.now();
console.log('소요 시간:', end - start, 'ms');
Output:
// 1705123456789 소요 시간: 5 ms

Related Methods