Purpose
Use this function to add/subtract a provided value in date/time units from the date-time variable. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
DateTimeAdd (input_datetime, value, units)
input_datetime (DateTime): A date-time input parameter
value (Integer) : Positive/Negative value in date-time units
units (String): Date-time units from below values.
- hr
- min
- sec
- day
- month
- year
- week
- century
- decade
Return Value
DateTime
Example
dim ddt as datetime
ddt = 20210524135341674
print DateTimeAdd(ddt, -1, "year")
//returns 20200524135341674