title | description | ms.author | ms.date | ms.tgt_pltfrm | ms.topic | author |
---|---|---|---|---|---|---|
Date Data Type |
Denotes a date ranging from January 1, 1753 to December 31, 9999. |
solsen |
02/26/2024 |
na |
reference |
SusanneWindfeldPedersen |
Version: Available or changed with runtime version 1.0.
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.
An undefined or blank date is specified by 0D. The undefined date is considered to be before all other 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.
The syntax for defining DateTime format follows the ISO standard.
- The syntax for defining Date format is
yyyymmddD
, whereD
is a mandatory letter. For example,20180325D
, read as the 25th of March, 2018.
To assign a normal date to a variable, use the following format: yyyymmddD
.
SQL Server stores information about both date and time in columns of the DateTime types. For date fields, [!INCLUDEd365fin_long_md] 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 [!INCLUDEd365fin_long_md] 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.
This example shows a valid assignment of date. This example is compiled and run on a computer with the regional format set to English (United States).
var
Date1: Date;
begin
Date1 := 20180612D;
Message(Format(Date1));
end;
The message window displays the following:
06/12/2018
Get Started with AL
Developing Extensions
About Dates in Business Central