Date Data Type
Denotes a date ranging from January 3, 0001 to December 31, 9999. An undefined or blank date is specified by 0D. The undefined date is considered to be before all other dates.
The displayed text format of the date is determined by your Regional and Language Options in Windows.
All dates have a corresponding closing date. The closing date for a given date is defined as a period of time that follows a given date and precedes the next normal date. Closing dates are sorted after their corresponding given date and before the next normal date.
The format of a normal date is <MMDDYY>D
The format of a closing date is <MMDDYY>C
If you use a date that is outside the valid date range, a run-time error occurs.
The following examples are valid assignments of dates with a Date variable MyDate on a computer with the regional format set to English (United States).
MyDate := 0D; MyDate := 112708D; MESSAGE(FORMAT(MyDate)); MyDate := 11271808D; MESSAGE(FORMAT(MyDate)); MyDate := 033108D; MESSAGE(FORMAT(MyDate));
The following shows what the message windows display on a computer with the regional format set to English (United States).
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
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 2009, and if you store a date in the database that is outside the valid range for a SQL DATETIME, a run-time error occurs.
In previous versions of Microsoft Dynamics NAV, the date data type denotes dates ranging from January 1, 0000 to December 31, 9999, and includes the undefined date, 0D. The undefined date was stored as January 1, 0000. Microsoft Dynamics NAV 2009 supports the date January 1, 0000 as a special case for compatibility with previous versions.