BIS fnc calculateDateTime: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...) |
||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
| arma3 | | arma3 | ||
|1.86 | |1.86 | ||
|gr1 = Environment | |gr1 = Environment | ||
| Returns the end datetime if an offset is passed, or the offset between start and end dates. | | Returns the end datetime if an offset is passed, or the offset between start and end dates. | ||
| [startDate, endDateOrOffset, timeUnit] call [[BIS_fnc_calculateDateTime]] | | [startDate, endDateOrOffset, timeUnit] call [[BIS_fnc_calculateDateTime]] | ||
|p1= startDate: [[Array]] in [[Date]] format - (Optional, default [[date]]) | |p1= startDate: [[Array]] in [[Date]] format - (Optional, default [[date]]) | ||
|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'' | |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'' | ||
|p3= timeUnit: [[String]] - (Optional, default "s") one of: | |p3= timeUnit: [[String]] - (Optional, default "s") one of: | ||
Line 21: | Line 21: | ||
* "d" - days | * "d" - days | ||
| [[Date]] or [[Number]] - [[Date]] if ''endDateOrOffset'' is a [[Number]], [[Number]] is ''endDateOrOffset'' is a [[Date]] | | [[Date]] or [[Number]] - [[Date]] if ''endDateOrOffset'' is a [[Number]], [[Number]] is ''endDateOrOffset'' is a [[Date]] | ||
|x1= <code>[<nowiki/>[[date]], 3600] [[call]] [[BIS_fnc_calculateDateTime]]; {{cc|returns date in 3600 seconds (60min, 1h)}} | |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/>[[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: [<nowiki/>[2035,8,28,11,55], [2035,8,29,11,55], "h"] [[call]] [[BIS_fnc_calculateDateTime]]; {{cc|returns 24}}</code> | ||
| [[date]], [[setDate]], [[BIS_fnc_setDate]] | | [[date]], [[setDate]], [[BIS_fnc_setDate]] | ||
}} | }} |
Revision as of 22:36, 17 January 2021
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 - 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