GetRealTime: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
This function gets the real server time and returns it in a table
This function gets the real server time and returns it in a table. If you want to get the in-game time (shown on GTA's clock) use [[getTime]].


==Syntax==
==Syntax==

Revision as of 23:28, 17 December 2007

This function gets the real server time and returns it in a table. If you want to get the in-game time (shown on GTA's clock) use getTime.

Syntax

table getRealTime()

Returns

Returns a table of substrings with different time format, false otherwise.

Member Meaning Range
second seconds after the minute 0-61*
minute minutes after the hour 0-59
hour hours since midnight 0-23
monthday day of the month 1-31
month months since January 0-11
year years since 1900
weekday days since Sunday 0-6
yearday days since January 1 0-365
isdst Daylight Saving Time flag
  • tm_sec is generally 0-59. Extra range to accommodate for leap seconds in certain systems.

Example

This example outputs local time (server or client, where ever it was triggered) as hours and minutes

function showtime ()
	local time = getRealTime()
	local hours = time.hour
	local minutes = time.minute
	outputChatBox ( "Local Time: "..hours..":"..minutes )
end

See Also