Time::getLocalTimeGmt: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
{{ClientsideJsFunction}} | |||
{{JSContainer| | |||
=== | === Summary === | ||
Retrieves the current UTC time, returning an object containing year, month, day, hour, minute, and second. | |||
=== Syntax === | |||
== | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
mp.game.time.getLocalTimeGmt(year, month, day, hour, minute, second); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See | |||
{{ | === 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:Time API]] | ||
[[Category:TODO: Example]] | [[Category:TODO: Example]] | ||
Latest revision as of 12:38, 10 December 2024
Client-Side Function
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}`);