string.FormattedTime

From Garry's Mod
Jump to: navigation, search
 string.FormattedTime( )

Contents

Description

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

Arguments

number float

The time in seconds to format.

Arguments

string format=nil

An optional formatting to use. If no format it specified, a table will be returned instead.

Returns

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


Examples

Example

Formats the time in seconds

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

Output:

01:30:00

Examples

Example

Returns a table with the time separated by units.

local time = string.FormattedTime( 90 )
PrintTable( time )

Output:


ms = 0

m = 1
s = 30

h = 0
Personal tools
Navigation