The milliseconds to convert.
The format to convert to. Accepts 's' for seconds, 'm' for minutes, 'h' for hours, 'd' for days.
TimeObject or the converted equivalent if a format is provided.
// { d: 2, h: 3, m: 4, s: 5 }
msToTime(1000 * 60 * 60 * 24 * 2 + 1000 * 60 * 60 * 3 + 1000 * 60 * 4 + 1000 * 5 + 6)
// 2
msToTime(1000 * 60 * 60 * 24 * 2 + 1000 * 60 * 60 * 3 + 1000 * 60 * 4 + 1000 * 5 + 6, 'd')
// 51
msToTime(1000 * 60 * 60 * 24 * 2 + 1000 * 60 * 60 * 3 + 1000 * 60 * 4 + 1000 * 5 + 6, 'h')
// 3064
msToTime(1000 * 60 * 60 * 24 * 2 + 1000 * 60 * 60 * 3 + 1000 * 60 * 4 + 1000 * 5 + 6, 'm')
// 183845
msToTime(1000 * 60 * 60 * 24 * 2 + 1000 * 60 * 60 * 3 + 1000 * 60 * 4 + 1000 * 5 + 6, 's')
Returns a time object (or a converted equivalent if a format is provided) converted from milliseconds.