📌  相关文章
📜  将毫秒转换为人类可读的字符串打字稿代码示例

📅  最后修改于: 2022-03-11 14:48:21.243000             🧑  作者: Mango

代码示例1
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}`
}