BIS fnc calculateDateTime: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{Function|= Comments " to "{{Function|Comments= ")
(Page filling)
Line 5: Line 5:
|1.86|Game version=
|1.86|Game version=


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


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


| <pre>/************************************************************
|p1= startDate: [[Array]] in [[Date]] format - (Optional, default [[date]]) |Parameter 1=
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'' |Parameter 2=
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
| [[Date]] or [[Number]] - [[Date]] if ''endDateOrOffset'' is a [[Number]], [[Number]] is ''endDateOrOffset'' is a [[Date]] |Return value=
Example: [date, 60, "m"] call BIS_fnc_CalculateDateTime
Example: [date, [2035,8,29,11,55], "h"] call BIS_fnc_CalculateDateTime
************************************************************/</pre>{{placeholder}}<!-- Remove this after fill-in --> |Description=


|[] call [[BIS_fnc_CalculateDateTime]]|Syntax=
|x1= <code>[<nowiki/>[[date]], 3600] [[call]] [[BIS_fnc_CalculateDateTime]]; {{cc|returns date in 3600 seconds (60min, 1h)}}
Example: [<nowiki/>[[date]], 60, "m"] [[call]] [[BIS_fnc_CalculateDateTime]]; {{cc|returns date in 60 minutes (1h)}}
Example: [<nowiki/>[2035,8,28,11,55], [2035,8,29,11,55], "h"] [[call]] [[BIS_fnc_CalculateDateTime]]; {{cc|returns 24}}</code> |Example 1=


|p1= parameter: Datatype - (Optional, default defValue) description |Parameter 1=
| [[date]], [[setDate]], [[BIS_fnc_setDate]] |See also=
}}


|Datatype - description|Return value=
|x1= <code></code>|Example 1=
|exec= call |Execution=
| |See also=
}}


[[Category:Function Group: DateTime|{{uc:CalculateDateTime}}]]
[[Category:Function Group: DateTime|{{uc:CalculateDateTime}}]]
[[Category:Functions|{{uc:CalculateDateTime}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:CalculateDateTime}}]]

Revision as of 18:44, 29 June 2020

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:
Uncategorised

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 - Date if endDateOrOffset is a Number, Number is endDateOrOffset is a Date

Examples

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

Additional Information

See also:
datesetDateBIS_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