convert-ms

A lightweight package to convert ms to hours, minutes, and/or seconds.

Usage no npm install needed!

<script type="module">
  import convertMs from 'https://cdn.skypack.dev/convert-ms';
</script>

README

About

convert-ms is a package for converting ms, to human time (hours, minutes, seconds).

Installation

Please make sure you have Node.js version 12.0.0 or later installed.

Add it to your project with: npm install convert-ms

Update it with: npm update convert-ms

Examples

const ms = require('convert-ms');

ms.toHMS(36000000);
// -> 10 hour(s), 0 minute(s), and 0 second(s)

ms.toHours(3600000);
// -> 10 hour(s)

ms.toMinutes(36000000);
// -> 600 minute(s)

ms.toSeconds(36000000);
// -> 36000 second(s)