systemTimeUTC: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[daytime" to "[[dayTime")
(Add example)
Line 12: Line 12:
|r1= [[Array]] in format [year, month, day, hour, minute, second, millisecond]
|r1= [[Array]] in format [year, month, day, hour, minute, second, millisecond]


|x1= <code>_UKTime = [[systemTimeUTC]];</code>
|x1= <code>[[private]] _UKTime = [[systemTimeUTC]];</code>


|x2= <code>[[systemTime]] [[apply]] {[[if]] (_x [[a less b|<]] 10) [[then]] {"0" [[+]] [[str]] _x} [[else]] {[[str]] _x}<nowiki>}</nowiki>; {{cc|["2021","05","03","14","09","37","593"]}}</code>
|x2= <code>[[systemTime]] [[apply]] { [[if]] (_x [[a less b|<]] 10) [[then]] { "0" [[+]] [[str]] _x } [[else]] { [[str]] _x } }; {{cc|["2021","05","03","14","09","37","593"]}}</code>
 
|x3= <code>[[private]] _timeUTC = [[systemTimeUTC]];
[[private]] _time = [[systemTime]];
[[private]] _timeDiffH = _timeUTC [[select]] 3 - _time [[select]] 3;
[[private]] _timeDiffM = _timeUTC [[select]] 4 - _time [[select]] 4;
[[if]] (_timeDiffM [[a less b|<]] 0) [[then]]
{
_timeDiffH = _timeDiffH - 1;
_timeDiffM = _timeDiffM + 60;
};
[[if]] (_timeDiffH [[a less b|<]] 12) [[then]]
{
_timeDiffH = _timeDiffH + 24;
};
[[if]] (_timeDiffH [[a greater b|>]] 12) [[then]]
{
_timeDiffH = _timeDiffH - 24;
};
[[private]] _timeZone = [_timeDiffH, _timeDiffM]; {{cc|hour (_timeDiffH) is in range -12..+12}}
</code>


|seealso= [[systemTime]], [[date]], [[time]], [[dayTime]], [[diag_tickTime]], [[serverTime]], [[missionStart]], [[diag_deltaTime]]
|seealso= [[systemTime]], [[date]], [[time]], [[dayTime]], [[diag_tickTime]], [[serverTime]], [[missionStart]], [[diag_deltaTime]]
}}
}}

Revision as of 11:57, 7 December 2021

Hover & click on the images for description

Description

Description:
Returns systemTime according to Universal Time Coordinated time scale.
Groups:
Time

Syntax

Syntax:
systemTimeUTC
Return Value:
Array in format [year, month, day, hour, minute, second, millisecond]

Examples

Example 1:
private _UKTime = systemTimeUTC;
Example 2:
systemTime apply { if (_x < 10) then { "0" + str _x } else { str _x } }; // ["2021","05","03","14","09","37","593"]
Example 3:
private _timeUTC = systemTimeUTC; private _time = systemTime; private _timeDiffH = _timeUTC select 3 - _time select 3; private _timeDiffM = _timeUTC select 4 - _time select 4; if (_timeDiffM < 0) then { _timeDiffH = _timeDiffH - 1; _timeDiffM = _timeDiffM + 60; }; if (_timeDiffH < 12) then { _timeDiffH = _timeDiffH + 24; }; if (_timeDiffH > 12) then { _timeDiffH = _timeDiffH - 24; }; private _timeZone = [_timeDiffH, _timeDiffM]; // hour (_timeDiffH) is in range -12..+12

Additional Information

See also:
systemTimedatetimedayTimediag_tickTimeserverTimemissionStartdiag_deltaTime

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