DateTimeAdd() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

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