Time::getLocalTimeGmt: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
console hash: 0xC589CD7D = GET_UTC_TIME<br>gets current UTC time
{{ClientsideJsFunction}}
==Syntax==
{{JSContainer|
<syntaxhighlight lang="javascript">mp.game.time.getLocalTimeGmt(year, month, day, hour, minute, second);</syntaxhighlight>
 
=== Required Arguments ===
=== Summary ===
*'''year:''' int
Retrieves the current UTC time, returning an object containing year, month, day, hour, minute, and second.
*'''month:''' int
 
*'''day:''' int
=== Syntax ===
*'''hour:''' int
*'''minute:''' int
*'''second:''' int
===Return value===
*'''object:''' year, month, day, hour, minute, second
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
mp.game.time.getLocalTimeGmt(year, month, day, hour, minute, second);
</syntaxhighlight>
</syntaxhighlight>
==See also==
 
{{Time_s_function_c}}
=== Required Parameters ===
* '''year:''' {{RageType|int}} - The current year in UTC.
* '''month:''' {{RageType|int}} - The current month in UTC.
* '''day:''' {{RageType|int}} - The current day in UTC.
* '''hour:''' {{RageType|int}} - The current hour in UTC.
* '''minute:''' {{RageType|int}} - The current minute in UTC.
* '''second:''' {{RageType|int}} - The current second in UTC.
 
=== Return Value ===
* '''Object:''' Contains the following properties:
  * `year`
  * `month`
  * `day`
  * `hour`
  * `minute`
  * `second`
 
=== Example ===
The following example retrieves the current UTC time and logs it to the chat:
<syntaxhighlight lang="javascript">
const utcTime = mp.game.time.getLocalTimeGmt();
mp.gui.chat.push(`Current UTC Time: ${utcTime.year}-${utcTime.month}-${utcTime.day} ${utcTime.hour}:${utcTime.minute}:${utcTime.second}`);
</syntaxhighlight>
}}
 
== See Also ==
{{Time_functions_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:Time API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 12:38, 10 December 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


Summary

Retrieves the current UTC time, returning an object containing year, month, day, hour, minute, and second.

Syntax

mp.game.time.getLocalTimeGmt(year, month, day, hour, minute, second);

Required Parameters

  • year: int - The current year in UTC.
  • month: int - The current month in UTC.
  • day: int - The current day in UTC.
  • hour: int - The current hour in UTC.
  • minute: int - The current minute in UTC.
  • second: int - The current second in UTC.

Return Value

  • Object: Contains the following properties:
 * `year`
 * `month`
 * `day`
 * `hour`
 * `minute`
 * `second`

Example

The following example retrieves the current UTC time and logs it to the chat:

const utcTime = mp.game.time.getLocalTimeGmt();
mp.gui.chat.push(`Current UTC Time: ${utcTime.year}-${utcTime.month}-${utcTime.day} ${utcTime.hour}:${utcTime.minute}:${utcTime.second}`);


See Also