This is the documentation for the development version. There are no official binaries for it; build it from the source code in git. Download links on these pages work only after the release. For the current release, see version 7.0.

FormatTimeSpan

FormatTimeSpan(seconds, withSeconds): String

Format a time span given in seconds as string in format "hh:mm", or "hh:mm:ss" if withSeconds is true. A time span of one day or longer starts with the number of days, as "1 day, " or "n days, ". Hours, minutes, and seconds always have two digits.

Without seconds, the value is rounded to the nearest minute (30 seconds or more round up), and the rounding can add a day (FormatTimeSpan(86370) returns "1 day, 00:00"). With seconds, no rounding is done.

A negative time span is formatted as its absolute value with a leading minus sign. A value that rounds to zero keeps the sign: FormatTimeSpan(-20) returns "-00:00".

Table 1. Parameters

seconds

Integer

Time span in seconds. Can be negative.

withSeconds

Boolean

Optional. true to include seconds in the result. Default value is false.

Return

Time span in format "[-][n days, ]hh:mm" or "[-][n days, ]hh:mm:ss".

>>> FormatTimeSpan(90061)
1 day, 01:01
>>> FormatTimeSpan(90061, true)
1 day, 01:01:01
>>> FormatTimeSpan(172800)
2 days, 00:00
>>> FormatTimeSpan(-90061)
-1 day, 01:01
>>> FormatTimeSpan(-43)
-00:01
>>> FormatTimeSpan(-43, true)
-00:00:43
>>> FormatTimeSpan(0)
00:00
See also

time, DateTime