NumberToDate() 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

Returns a Date value, given an integer. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

NumberToDate( numeric_date ) 

numeric_date is an integer representing the date in a YYYYMMDD format, where YYYY is the year, MM is the month between 01 (January) and 12 (December), and DD is the day of the month between 01 and 31.

Return Value

Date

Description

The NumberToDate() function returns a Date value represented by an eight-digit integer. For example, the following function call returns a Date value of December 31, 2015:

NumberToDate(20151231)

Example

The following example subtracts one Date value from another Date. The result of the subtraction is the number of days between the two dates. i_elapsed contains the number of days since January 1, 2016.

Dim i_elapsed As Integer
i_elapsed = CurDate() - NumberToDate(20160101)

See Also:

Date and Time Functions, StringToDate() function, Set Format statement, Str$() function, NumberToDateTime() function, NumberToTime() function