{"name":"date","operator":null,"title":"date","type":"command","url":"https://community.bistudio.com/wiki/date","revid":377601,"updated":"2026-01-02T08:16:59Z","groups":["Environment"],"status":"ok","replaced_by":[],"games":[{"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":"arma1","name":"Armed Assault","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":"local","server_exec":false},"exec":null,"description":"Return the actual in-mission date and time.","syntaxes":[{"syntax":"date","since":null,"effect":null,"exec":null,"params":[],"returns":{"type":"Date","types":["Date"],"description":null,"text":"Date"},"form":"nullary","operator":null,"left":null,"right":null}],"examples":[{"text":"```sqf\n// in Arma 3\ndate params [\"_year\", \"_month\", \"_day\", \"_hours\", \"_minutes\"];\n\n// pre Arma 3\nprivate [\"_now\", \"_year\", \"_month\", \"_day\", \"_hours\", \"_minutes\"];\n_now = date;    // [2014,10,30,2,30] a.k.a Oct. 30th, 2:30am\n_year        = _now select 0;\n_month        = _now select 1;\n_day        = _now select 2;\n_hours        = _now select 3;\n_minutes    = _now select 4;\n```","code":["// in Arma 3\ndate params [\"_year\", \"_month\", \"_day\", \"_hours\", \"_minutes\"];\n\n// pre Arma 3\nprivate [\"_now\", \"_year\", \"_month\", \"_day\", \"_hours\", \"_minutes\"];\n_now = date;\t// [2014,10,30,2,30] a.k.a Oct. 30th, 2:30am\n_year\t\t= _now select 0;\n_month\t\t= _now select 1;\n_day\t\t= _now select 2;\n_hours\t\t= _now select 3;\n_minutes\t= _now select 4;"]},{"text":"```sqf\nif (date select 3 >= 19) then        // 7pm\n{\n    hintSilent \"ah, Arma sunset\";    // ...cue bad guys\n};\n```","code":["if (date select 3 >= 19) then\t\t// 7pm\n{\n\thintSilent \"ah, Arma sunset\";\t// ...cue bad guys\n};"]}],"multiplayer":"Returns the current **local** (MP client) in-game date.\n\n> [!NOTE]\n> **Arma 3:** Clients' local date is automatically and periodically synchronised with the server date.","problems":null,"aliases":[],"see_also":["setDate","dateToNumber","numberToDate","time","missionStart","systemTime","systemTimeUTC"],"notes":[{"user":"Lou Montana","date":"2018-01-23T23:35:00Z","text":"a useful script to format the date:\n\n```sqf\n_curDate = date;\nprivate _ddMMyyyy = format [\"%3/%2/%1\",\n    _curDate select 0,\n    (if (_curDate select 1 < 10) then { \"0\" } else { \"\" }) + str (_curDate select 1),\n    (if (_curDate select 2 < 10) then { \"0\" } else { \"\" }) + str (_curDate select 2)\n];\n```\n\nit can be shortened to: (no intermediary variable but more request to date)\n\n```sqf\nprivate _ddMMyyyy = format [\"%3/%2/%1\",\n    date select 0,\n    (if (date select 1 < 10) then { \"0\" } else { \"\" }) + str (date select 1),\n    (if (date select 2 < 10) then { \"0\" } else { \"\" }) + str (date select 2)\n];\n```\n\n**EDIT:** or to\n\n```sqf\nprivate _ddMMyyyy = format [\"%4%5/%2%3/%1\",\n    date select 0,\n    [\"\", \"0\"] select (date select 1 < 10),\n    date select 1,\n    [\"\", \"0\"] select (date select 2 < 10),\n    date select 2\n];\n```"}],"categories":["ArmA: Armed Assault: New Scripting Commands","ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Environment","Introduced with Armed Assault version 1.00","Scripting Commands","Scripting Commands: Local Effect","Take On Helicopters: Scripting Commands"]}