formatTime()

Formats the time (number of milliseconds) given based on a format string.

This function is valid in v2.8.0 to v2.14.0. This function has been downloaded 43 times.

Parameters

{number} ms
Number of milliseconds that will be represented in the returned string.
{string} format
Format string where W (or w) will be replaced by the number of weeks, D (or d) by the number of days (maximum being 6), H (or h) by the number of hours (maximum being 23), m by the number of minutes (maximum being 59), s by the number of seconds (maximum being 59), and S by the number of milliseconds (maximum being 999). Adding an exclamation point to the end of any of those characters (eg. S!) will result in the corresponding value not being truncated based on the next highest time increment. Using HH, hh, mm, ss or SSS will result in leading zeroes for those corresponding values. Instances of - will be removed only if ms is positive. Instances of + will be replaced with - only if ms is negative, otherwise + will remain. Wrapping a substring in single quotes or double quotes will cause that substring to be escaped and any instances of that same quote character being repeated once will be replaced with just one.

Returns

{string}
The value of ms formatted based on format.