Date Data Type

Denotes a date ranging from January 1, 1753 to December 31, 9999.

The displayed text format of the date is determined by your Region and Language Format setting in Windows.

Undefined dates

An undefined or blank date is specified by 0D. The undefined date is considered to be before all other dates.

Normal dates and closing dates

All normal dates have a corresponding closing date. The closing date for a given date is defined as a period of time that follows a given normal date and precedes the next normal date.

To assign a normal date to a variable, use the following format: D

To assign a closing date to a variable, use the CLOSINGDATE method (Date).

Year format

If the year is defined by two digits and is between 30 and 99, then it is considered to be in the 1900s. If it is between 00 and 29, then it is considered to be in the 2000s.

Storing dates in the SQL server database

SQL Server stores information about both date and time in columns of the DATETIME types. For date fields, Dynamics 365 for Finance and Operations, Business edition uses only the date and uses a constant value for the time. For a normal date, this constant value contains 00:00:00:000. For a closing date, it contains 23:59:59:000.

The Dynamics 365 for Finance and Operations, Business edition undefined date is represented by the earliest valid date in SQL Server. The earliest valid date in SQL Server for a DATETIME is 01-01-1753 00:00:00:000.

If you store a date in the database that is outside the valid range for a SQL DATETIME, a run-time error occurs.


The methods supported for the Date data type are:

CALCDATE method (Date)
CLOSINGDATE method (Date)
DATE2DMY method (Date)
DATE2DWY method (Date)
DMY2DATE method (Date)
DWY2DATE method (Date)
NORMALDATE method (Date)
TODAY method (Date)
WORKDATE method (Date)


This example shows valid assignments of Dates. It requires that you define the following variable.

Variable DataType
Date1 Date

This example is compiled and run on a computer with the regional format set to English (United States).

Date1 := 0D;  
Date1 := 112710D;  
Date1 := 11271810D;  

The message window displays the following:




When you assign a value to a date variable, the value that you assign must be in the correct format for the regional setting of the computer. For example, if the computer is set to English (United States), then Date1 := 271108D; results in a compiler error.

See Also

AL Data types
AL Method Reference