turn milliseconds to human readable string typescript

The solution for “turn milliseconds to human readable string typescript” can be found here. The following code will assist you in solving the problem.

public static msToTime (ms: number): string {
const date = new Date(ms)
const h = date.getHours()
const m = date.getMinutes()
const s = date.getSeconds()

return `${h < 10 ? `0${h}` : h}:${m < 10 ? `0${m}` : m}:${s < 10 ? `0${s}` : s}` }

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in