Compares two date-time values and returns the difference.
Result := DateDiff(DateTime1, DateTime2, TimeUnits)
Type: String
Date-time stamps in the YYYYMMDDHH24MISS format.
If either is an empty string, the current local date and time (A_Now) is used.
Type: String
Units to measure the difference in. TimeUnits may be one of the following strings (or just the first letter): Seconds, Minutes, Hours or Days.
Type: Integer
This function returns the difference between the two timestamps, in the units specified by TimeUnits. If DateTime1 is earlier than DateTime2, a negative number is returned.
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.
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 DateAdd (subtraction is achieved by adding a negative number).
If DateTime contains an invalid timestamp or a year prior to 1601, a ValueError is thrown.
DateAdd, FileGetTime, FormatTime