1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

問題

ミリ秒を時分秒に変換する方法の紹介です!

解決方法

以下のようにミリ秒を変換する処理を入れればよいです!

// 実行開始の起点
const start: number = require('perf_hooks').performance.now();

// 諸々の処理

// 実行終了の起点
const end: number = require('perf_hooks').performance.now();

// ミリ秒を変換する処理
const time: number = Number((end - start).toFixed());
const h: number = Math.floor(time / 3600000);
const m: number = Math.floor((time - h * 3600000) / 60000);
const s: number = Math.round((time - h * 3600000 - m * 60000) / 1000);

// 実行時間を出力
console.log(`Execute time is ${h}:${m}:${s}`);

処理時間を計測するコードはこちらを参照してください、、!

1
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?