Time::getLocalTime
Client-Side Function
JavaScript Syntax
Summary
Retrieves the local system time, returning an object containing year, month, day, hour, minute, and second.
Syntax
mp.game.time.getLocalTime(year, month, day, hour, minute, second);
Required Parameters
- year: int - The current year based on the local system clock.
- month: int - The current month based on the local system clock.
- day: int - The current day based on the local system clock.
- hour: int - The current hour based on the local system clock.
- minute: int - The current minute based on the local system clock.
- second: int - The current second based on the local system clock.
Return Value
- Object: Contains the following properties:
* `year` * `month` * `day` * `hour` * `minute` * `second`
Example
This example retrieves the local system time and displays it in the in-game chat:
const localTime = mp.game.time.getLocalTime();
mp.gui.chat.push(`Local Time: ${localTime.year}-${localTime.month}-${localTime.day} ${localTime.hour}:${localTime.minute}:${localTime.second}`);