BIS fnc calculateDateTime: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (infobox to template)
m (Text replacement - " |s1=[" to " |s1= [")
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function


| arma3 |Game name=
|game1= arma3
|version1= 1.86


|1.86|Game version=
|gr1= Environment


<!---|arg= local |Multiplayer Arguments=--->
|descr= Returns the end datetime if an offset is passed, or the offset between start and end dates.


<!---|eff= local |Multiplayer Effects=--->
|s1= [startDate, endDateOrOffset, timeUnit] call [[BIS_fnc_calculateDateTime]]


| <pre>/************************************************************
|p1= startDate: [[Array]] in [[Date]] format - (Optional, default [[date]])
Calculate Date
Author: Zozo


Parameters: [start datetime, time offset (in seconds) or end datetime, time unit]
|p2= endDateOrOffset: [[Array]] in [[Date]] format or [[Number]] - (Optional, default [[date]]) either the end date of the period to calculate, or time in seconds from ''startDate''
time unit:
- "s" (default) - seconds
- "m" - minutes
- "h" - hours
- "d" - days


Returns the new datetime if offset is passed or
|p3= timeUnit: [[String]] - (Optional, default "s") one of:
difference between dates if end datetime is passed
* "s" - seconds
(in seconds)
* "m" - minutes
* "h" - hours
* "d" - days


Example: [date, 3600] call BIS_fnc_CalculateDateTime
|r1= [[Date]] or [[Number]]
Example: [date, 60, "m"] call BIS_fnc_CalculateDateTime
* [[Date]] if ''endDateOrOffset'' is a [[Number]]
Example: [date, [2035,8,29,11,55], "h"] call BIS_fnc_CalculateDateTime
* [[Number]] is ''endDateOrOffset'' is a [[Date]]
************************************************************/</pre>{{placeholder}}<!-- Remove this after fill-in --> |Description=


|[] call [[BIS_fnc_CalculateDateTime]]|Syntax=
|x1= <sqf>
[date, 3600] call BIS_fnc_calculateDateTime; // returns date in 3600 seconds (60min, 1h)
[date, 60, "m"] call BIS_fnc_calculateDateTime; // returns date in 60 minutes (1h)
[[2035,8,28,11,55], [2035,8,29,11,55], "h"] call BIS_fnc_calculateDateTime; // returns 24
</sqf>


|p1= parameter: Datatype - (Optional, default defValue) description |Parameter 1=
|seealso= [[date]] [[setDate]] [[BIS_fnc_setDate]]
 
|Datatype - description|Return value=
 
|x1= <code></code>|Example 1=
 
|exec= call |Execution=
 
| |See also=
}}
}}
[[Category:Function Group: DateTime|{{uc:CalculateDateTime}}]]
[[Category:Functions|{{uc:CalculateDateTime}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:CalculateDateTime}}]]

Latest revision as of 00:11, 13 July 2022

Hover & click on the images for description

Description

Description:
Returns the end datetime if an offset is passed, or the offset between start and end dates.
Execution:
call
Groups:
Environment

Syntax

Syntax:
[startDate, endDateOrOffset, timeUnit] call BIS_fnc_calculateDateTime
Parameters:
startDate: Array in Date format - (Optional, default date)
endDateOrOffset: Array in Date format or Number - (Optional, default date) either the end date of the period to calculate, or time in seconds from startDate
timeUnit: String - (Optional, default "s") one of:
  • "s" - seconds
  • "m" - minutes
  • "h" - hours
  • "d" - days
Return Value:
Date or Number

Examples

Example 1:
[date, 3600] call BIS_fnc_calculateDateTime; // returns date in 3600 seconds (60min, 1h) [date, 60, "m"] call BIS_fnc_calculateDateTime; // returns date in 60 minutes (1h) [[2035,8,28,11,55], [2035,8,29,11,55], "h"] call BIS_fnc_calculateDateTime; // returns 24

Additional Information

See also:
date setDate BIS_fnc_setDate

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note