BIS fnc calculateDateTime: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Initial Export)
 
m (Text replacement - " |s1=[" to " |s1= [")
 
(24 intermediate revisions by 4 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
____________________________________________________________________________________________


| <pre>
|descr= Returns the end datetime if an offset is passed, or the offset between start and end dates.
/************************************************************
Calculate Date


Parameters: [start datetime, time offset (in seconds) or end datetime, time unit]
|s1= [startDate, endDateOrOffset, timeUnit] call [[BIS_fnc_calculateDateTime]]
time unit:
- "s" (default) - seconds
- "m" - minutes
- "h" - hours
- "d" - days


Returns the new datetime if offset is passed or
|p1= startDate: [[Array]] in [[Date]] format - (Optional, default [[date]])
difference between dates if end datetime is passed
(in seconds)


Example: [date, 3600] call BIS_fnc_CalculateDateTime
|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''
Example: [date, 60, "m"] call BIS_fnc_CalculateDateTime
Example: [date, [2035,8,29,11,55], "h"] call BIS_fnc_CalculateDateTime
************************************************************/


#define TIME_FLOAT_CONVERT_DAYS   365
|p3= timeUnit: [[String]] - (Optional, default "s") one of:
#define TIME_FLOAT_CONVERT_HOURS 8760
* "s" - seconds
#define TIME_FLOAT_CONVERT_MINUTES 525600
* "m" - minutes
#define TIME_FLOAT_CONVERT_SECONDS 31536000
* "h" - hours
* "d" - days


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|r1= [[Date]] or [[Number]]
____________________________________________________________________________________________
* [[Date]] if ''endDateOrOffset'' is a [[Number]]
* [[Number]] is ''endDateOrOffset'' is a [[Date]]


| <!-- [] call [[BIS_fnc_CalculateDateTime]]; --> |= Syntax
|x1= <sqf>
 
[date, 3600] call BIS_fnc_calculateDateTime; // returns date in 3600 seconds (60min, 1h)
|p1= |= Parameter 1
[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
| |= Return value
</sqf>
____________________________________________________________________________________________
 
|x1= &lt;code&gt;&lt;/code&gt; |=
____________________________________________________________________________________________
 
| |= See also


|seealso= [[date]] [[setDate]] [[BIS_fnc_setDate]]
}}
}}
&lt;h3 style="display:none"&gt;Notes&lt;/h3&gt;
&lt;dl class="command_description"&gt;
&lt;!-- Note Section BEGIN --&gt;
&lt;!-- Note Section END --&gt;
&lt;/dl&gt;
&lt;h3 style="display:none"&gt;Bottom Section&lt;/h3&gt;
[[Category:Function Group: DateTime|{{uc:CalculateDateTime}}]]
[[Category:Functions|{{uc:CalculateDateTime}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:CalculateDateTime}}]]

Latest revision as of 23:11, 12 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