{"name":"setDate","operator":null,"title":"setDate","type":"command","url":"https://community.bistudio.com/wiki/setDate","revid":377265,"updated":"2026-01-02T06:34:05Z","groups":["Mission Information","Environment"],"status":"ok","replaced_by":[],"games":[{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":"local","server_exec":false},"exec":null,"description":"Sets mission date and time. Players joining after mission start will get the current server date including the year.\n\n> [!IMPORTANT]\n> While the game creates February 29th in a leap year, it removes December 31st.\n>\n> 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.","syntaxes":[{"syntax":"setDate date","since":null,"effect":null,"exec":null,"params":[{"name":"date","type":"Date","optional":false,"default":null,"description":null,"types":["Date"],"since":null,"text":"date: Date"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"unary","operator":null,"left":null,"right":{"text":"date","types":["Date"]}}],"examples":[{"text":"```sqf\nsetDate [1986, 2, 25, 16, 0]; // 4:00pm February 25, 1986\n```","code":["setDate [1986, 2, 25, 16, 0]; // 4:00pm February 25, 1986"]},{"text":"```sqf\n// Set the real date:\nif (isServer) then\n{\n    waitUntil { time > 0 };\n    [systemTime select [0, 5]] remoteExec [\"setDate\"];\n};\n```","code":["// Set the real date:\nif (isServer) then\n{\n\twaitUntil { time > 0 };\n\t[systemTime select [0, 5]] remoteExec [\"setDate\"];\n};"]},{"text":"Using setDate with an incorrect (like negative or exceeding) value will still work properly:\n\n```sqf\nprivate _date = date;\n_date set [3, 25];    // set hour to 25\nsetDate _date;        // date = next day 1am\n```","code":["private _date = date;\n_date set [3, 25];\t// set hour to 25\nsetDate _date;\t\t// date = next day 1am"]}],"multiplayer":"> [!NOTE]\n> **Arma 3:** Clients' local date is automatically and periodically synchronised with the server date.\n>\n> In order to change the date without waiting for automatic synchronisation, use remote execution: `[[2001,6,22,12,0]] remoteExec [\"setDate\"];`.","problems":null,"aliases":[],"see_also":["date","skipTime","numberToDate","dateToNumber"],"notes":[{"user":"Alpha","date":"2012-12-07T11:10:00Z","text":"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."},{"user":"Osmo","date":"2011-10-31T21:07:00Z","text":"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."},{"user":"MulleDK13","date":"2014-10-04T17:43:00Z","text":"Since an unknown version of Arma 3, this command now has global effect when executed on the server."},{"user":"OOKexOo","date":"2017-04-23T02:58:00Z","text":"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.\n\n```sqf\n[[], { setDate [1986, 2, 25, 16, 0] }] remoteExec [\"call\", 0, \"JIP_id_setDate\"];\n```"}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Environment","Command Group: Mission Information","Introduced with Operation Flashpoint: Elite version 1.00","Operation Flashpoint: Elite: New Scripting Commands","Operation Flashpoint: Elite: Scripting Commands","Scripting Commands","Scripting Commands: Local Effect","Take On Helicopters: Scripting Commands"]}