RU/getRealTime: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 21: Line 21:
|'''Range'''
|'''Range'''
|-
|-
|second
|Секунды
|seconds after the minute
|seconds after the minute
|0-61*
|0-61*
|-
|-
|minute
|Минуты
|minutes after the hour
|minutes after the hour
|0-59
|0-59
|-
|-
|hour
|Часы
|hours since midnight
|hours since midnight
|0-23
|0-23
|-
|-
|monthday
|Месяца
|day of the month
|day of the month
|1-31
|1-31
Line 41: Line 41:
|0-11
|0-11
|-
|-
|year
|Год
|years since 1900
|years since 1900
|-
|-
|weekday
|День Недели
|days since Sunday
|days since Sunday
|0-6
|0-6
Line 68: Line 68:
local hours = time.hour
local hours = time.hour
local minutes = time.minute
local minutes = time.minute
outputChatBox ( "Local Time: "..hours..":"..minutes )
outputChatBox ( "Время сервера: "..hours..":"..minutes )
end
end
</syntaxhighlight>
</syntaxhighlight>

Revision as of 11:20, 1 November 2016

Warning.png This page requires local translation. If page will remain not translated in reasonable period of time it would be deleted.
After translating the page completely, please remove the ‎{{translate}}‎ tag from the page.


This function gets the server or client (if used client sided it returns time as set on client's computer) real 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( [int seconds = current] )

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • seconds: A count in seconds from the year 1970. Useful for storing points in time, or for retrieving time information for getBanTime. The valid range of this argument is 0 to 32,000,000,000

Returns

Returns a table of substrings with different time format or false if the seconds argument is out of range.

Member Meaning Range
Секунды seconds after the minute 0-61*
Минуты minutes after the hour 0-59
Часы hours since midnight 0-23
Месяца day of the month 1-31
month months since January 0-11
Год years since 1900
День Недели days since Sunday 0-6
yearday days since January 1 0-365
isdst Daylight Saving Time flag
timestamp seconds since 1970 (MTA 1.1 +)
  • 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 ( "Время сервера: "..hours..":"..minutes )
end

See Also