Adds or subtracts time from a date-time value.

Result := DateAdd(DateTime, Time, TimeUnits)



Type: String

A date-time stamp in the YYYYMMDDHH24MISS format.


Type: Integer or Float

The amount of time to add, as an integer or floating-point number. Specify a negative number to perform subtraction.


Type: String

The meaning of the Time parameter. TimeUnits may be one of the following strings (or just the first letter): Seconds, Minutes, Hours or Days.

Return Value

Type: String

This function returns a string of digits in the YYYYMMDDHH24MISS format. This string should not be treated as a number (one should not perform math on it or compare it numerically).


The built-in variable A_Now contains the current local time in YYYYMMDDHH24MISS format.

To calculate the amount of time between two timestamps, use DateDiff.

If DateTime contains an invalid timestamp or a year prior to 1601, an exception is thrown.


DateDiff, FileGetTime, FormatTime


; Calculate the date 31 days from now.
later := DateAdd(A_Now, 31, "days")
MsgBox FormatTime(later)