AddDateTime Function

Action

Adds time to a DATETIME value and returns the new DATETIME.

Syntax

newDT=AddDateTime (Datetime=[, iDays, iHours, iMins, iSecs, iMsecs])
Variable Description
newDT Returned sum of datetime and specified time values. DATETIME.
Datetime The original DATETIME value. DATETIME.
iDays Optional. A day’s value to add to Datetime. INTEGER.
iHours Optional. An hour’s value to add to Datetime. INTEGER.
iMins Optional. A minute’s value to add to Datetime. INTEGER.
iSecs Optional. A second’s value to add to Datetime. INTEGER.
iMsecs Optional. A microsecond’s value to add to Datetime. INTEGER.

Notes

The DATETIME data type represents values from 4713 BC to 19999 AD. You can use this function to add positive or negative numbers to a DATETIME value. The optional values are not artificially constrained—for example, you are not limited to values less than 24 for iHours or less than 60 for iMins. Remember that there is no year zero.

To skip over an optional argument, use NULL as a placeholder.

Example

datetime = GetDateTime ()
// increment current time by one hour
newDateTime = AddDateTime (datetime, NULL, 1)