Denotes a date ranging from January 3, 0001 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: <MMDDYY>D
To assign a closing date to a variable, use the CLOSINGDATE Function (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.
SQL Server Constraints
Microsoft SQL Server stores information about both date and time in columns of the DATETIME types. For date fields, Microsoft Dynamics NAV 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 Microsoft Dynamics NAV 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 use a SQL Server database with Microsoft Dynamics NAV 2013 R2, and if you store a date in the database that is outside the valid range for a SQL DATETIME, a run-time error occurs.
Example
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).
Copy Code | |
---|---|
Date1 := 0D; Date1 := 112710D; MESSAGE(FORMAT(Date1)); Date1 := 11271810D; MESSAGE(FORMAT(Date1)); |
The message window displays the following:
11/27/10
11/27/1810
Note |
---|
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
Reference
CALCDATE Function (Date)CLOSINGDATE Function (Date)
DATE2DMY Function (Date)
DATE2DWY Function (Date)
DATI2VARIANT Function (Date, Variant)
DMY2DATE Function (Date)
DWY2DATE Function (Date)
NORMALDATE Function (Date)
TODAY Function (Date)
VARIANT2DATE Function (Date, Variant)
WORKDATE Function (Date)