Garry's Mod Wiki

string string format, number time )


Returns the date/time as a formatted string or in a table.


1 string format
The format string.

If this is equal to '*t' or '!*t' then this function will return a Structures/DateData, otherwise it will return a string.

If this starts with an '!', the returned data will use the UTC timezone rather than the local timezone.

See for available format flags.

Not all flags are available on all operating systems and the result of using an invalid flag is undefined. This currently crashes the game on Windows. Most or all flags are available on OS X and Linux but considerably fewer are available on Windows. See for a list of available flags on Windows. Note that the # flags also crashes the game on Windows.
2 number time
Time to use for the format.


1 string
Formatted date

This will be a Structures/DateData if the first argument equals to '*t' or '!*t'


This will use the os.time() function, and return it in a friendly way. os.time() is useful for storing as a date stamp but needs this to make it readable.

local Timestamp = os.time() local TimeString = "%H:%M:%S - %d/%m/%Y" , Timestamp ) print( "Timestamp:", Timestamp ) print( "TimeString:", TimeString )
Output: Timestamp: 1581691801 TimeString: 14:50:01 - 14/02/2020

Page Links

Special Pages



Render Time: 31ms

Session 0
DB GetPage 4
Generate Html 3
SaveChanges 9
Render Body 0
Render Sidebar 12