ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getRealTime

Function

getRealTime

Returns the real date and time of the server (or the player's computer) as a table: second, minute, hour, monthday, month (0-11), year (years since 1900), weekday (0 = Sunday), yearday, isdst and timestamp. With an argument it breaks down the given timestamp.

Syntax

table getRealTime([int seconds])

Arguments

secondsint, optional
A timestamp (seconds since 1970).

Differences from MTA:SA

  • These MTA:SA arguments are not here: bool localTime = true

In MTA:SA

getRealTime(int seconds = current, bool localTime = true)

Returns

A table with date fields.

Example

local t = getRealTime()
outputServerLog(("%02d.%02d.%d %02d:%02d"):format(t.monthday, t.month + 1, t.year + 1900, t.hour, t.minute))

See also