hhmmss-util
Installation
npm install --save hhmmss-util
Basic Usage
hhmmss(seconds, [options])
var hhmmss = ; //Basic usage, default outputs seconds as h:mm:ssconsole; //outputs: 1:00:01console; //outputs: 04:20
Options
milliseconds
Duration is in milliseconds.
//Use milliseconds instead of seconds; //outputs 1:00:01
type
The type of data to return. Default is a h:mm:ss string.
Option | Description |
---|---|
string |
(default) Will return an string in hh:mm:ss format. |
array |
Will return an array containing [h, m, s]. |
//Output an array containing hh mm ss digits; //outputs 04:20; //outputs [4,20]
precision
The precision of the seconds field. Default is to round to nearest integer.
//Output an array containing hh mm ss digits; //outputs 04:20.22
zeropad
Enable or disable zero padding. Default is true;
//Output an array containing hh mm ss digits; //outputs 4:20