Formats the time (number of milliseconds) given based on a format string. If you want to format time using a Date object with a timezone different from UTC (GMT) you should use formatDate().

This function is valid in v2.19.0 to v2.24.2. This function has been downloaded 33 times.


{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. Wrapping a substring with the hash character (#) will result in a conditional string where any underlying substring wrapped in parentheses will only be returned if the preceding meta-group is not 1. If the the conditional substring is specified and the preceding meta-group is 1 then either nothing will be printed or if the parenthesized group contains an unescaped vertical bar anything found thereafter will be printed.


The value of ms formatted based on format.