Garry's Mod Wiki

string.FormattedTime

string string.FormattedTime( number float, string format = "nil" )

Description

Returns the time as a formatted string or as a table if no format is given.

Arguments

1 number float
The time in seconds to format.
2 string format = "nil"
An optional formatting to use. If no format it specified, a table will be returned instead.

Returns

1 string
Returns the time as a formatted string only if a format was specified.

Returns a table only if no format was specified. The table will contain these fields:

number ms - milliseconds

number s - seconds

number m - minutes

number h - hours

Example

Formats the time in seconds

local time = string.FormattedTime( 90, "%02i:%02i:%02i" ) print( time )
Output: 01:30:00

Example

Returns a table with the time separated by units.

local time = string.FormattedTime( 90 ) PrintTable( time )
Output: <br>ms = 0<br> m = 1<br> s = 30<br> h = 0<br>

Page Links


Special Pages


Wikis

?

Render Time: 99ms

Session 0
DB GetPage 8
Generate Html 13
SaveChanges 58
Render Body 0
Render Sidebar 12