Sets a variable to itself minus the given value (can also compare date-time values). Synonymous with: Var -= Value
.
EnvSub, Var, Value , TimeUnits Var -= Value , TimeUnits Var--
The name of the variable upon which to operate.
Any integer, floating point number, or expression.
If present, this parameter directs the command to subtract Value from Var as though both of them are date-time stamps in the YYYYMMDDHH24MISS format. TimeUnits can be either Seconds, Minutes, Hours, or Days (or just the first letter of each of these). If Value is blank, the current time will be used in its place. Similarly, if Var is an empty variable, the current time will be used in its place.
The result is always rounded down to the nearest integer. For example, if the actual difference between two timestamps is 1.999 days, it will be reported as 1 day. If higher precision is needed, specify Seconds for TimeUnits and divide the result by 60.0, 3600.0, or 86400.0.
If either Var or Value is an invalid timestamp or contains a year prior to 1601, Var will be made blank to indicate the problem.
The built-in variable A_Now contains the current local time in YYYYMMDDHH24MISS format.
To precisely determine the elapsed time between two events, use the A_TickCount method because it provides millisecond precision.
To add or subtract a certain number of seconds, minutes, hours, or days from a timestamp, use EnvAdd (subtraction is achieved by adding a negative number).
This command is equivalent to the shorthand style: Var -= Value
.
Variables can be increased or decreased by 1 by using Var++
, Var--
, ++Var
, or --Var
.
If either Var or Value is blank or does not start with a number, it is considered to be 0 for the purpose of the calculation (except when used internally in an expression and except when using the TimeUnits parameter).
If either Var or Value contains a decimal point, the end result will be a floating point number in the format set by SetFormat.
EnvAdd, EnvMult, EnvDiv, SetFormat, Expressions, If var is [not] type, SetEnv, FileGetTime