Arma 3 Scripting

Command in Mission Information, Environment

setDate

Also available as Markdown and JSON, or read the original wiki page.

Description

Sets mission date and time. Players joining after mission start will get the current server date including the year.

Important

While the game creates February 29th in a leap year, it removes December 31st.

For example, setDate [1980,12,31,12,0] will result in the game jumping to [1981,1,1,12,0] as 1980 is a leap year.

Syntax

setDate date

Parameters:

Returns: Nothing

Examples

Example 1

setDate [1986, 2, 25, 16, 0]; // 4:00pm February 25, 1986

Example 2

// Set the real date:
if (isServer) then
{
    waitUntil { time > 0 };
    [systemTime select [0, 5]] remoteExec ["setDate"];
};

Example 3

Using setDate with an incorrect (like negative or exceeding) value will still work properly:

private _date = date;
_date set [3, 25];    // set hour to 25
setDate _date;        // date = next day 1am

Multiplayer

Note

Arma 3: Clients' local date is automatically and periodically synchronised with the server date.

In order to change the date without waiting for automatic synchronisation, use remote execution: [[2001,6,22,12,0]] remoteExec ["setDate"];.

See also

date · skipTime · numberToDate · dateToNumber

Community notes

Alpha

This command sets the date for the southern hemisphere only, i.e. when the map is in northern hemisphere a date [2010,12,7,17,0] is in day light and and date [2010,6,7,17,0] is in darkness.

Osmo

In multiplayer, the effect of this command is local, not global. The date from the server is synchronized with clients when they join the game (including start of the mission and joining in progress). E.g. if this command is executed on server in the init.sqf before the mission starts, every client will be synchronized with server as mission is started. However, if you run this command in the middle of the mission, effect is local.

MulleDK13

Since an unknown version of Arma 3, this command now has global effect when executed on the server.

OOKexOo

Regarding execution in the middle of a session, the post of MulleDK13 is not entirely true. If you don't change the year, you are perfectly fine when executing the command on the server only. However, the server does not sync the year. Hence, if you do change the year, you have to execute the command on the server, clients and JIP to account for the missing sync. e.g.

[[], { setDate [1986, 2, 25, 16, 0] }] remoteExec ["call", 0, "JIP_id_setDate"];