Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ms-to-hms

nikoladev69MIT1.0.0

Tiny module that converts milliseconds to an h:mm:ss string

h:mm:ss, hh:mm:ss, ms, milliseconds, seconds, minutes, hours, time, format, zero dependencies, no dependencies, dependency free, small, tiny

readme

ms-to-hms

Tiny module that takes milliseconds and outputs as h:mm:ss 5025000'1:23:45'

Install

npm install ms-to-hms

Usage

const msToHms = require('ms-to-hms')

msToHms(0)         // '0:00:00'
msToHms(-654321)   // '-0:10:54'
msToHms(123456789) // '34:17:36'

API

msToHms(ms)

Convert milliseconds into formatted time string.

Parameters

  • ms Time in milliseconds. Can be either positive or negative.
    • Type: number
    • Note: the function will throw if ms is a NaN or anything but a number.

License

MIT