Time::getLocalTimeGmt

From RAGE Multiplayer Wiki
Revision as of 12:38, 10 December 2024 by Shr0x (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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