{"title":"Date data type","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/date/date-data-type/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/date/date-data-type, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/date/date-data-type","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Denotes a date ranging from January 1, 1753 to December 31, 9999.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Instance methods","slug":"instance-methods","at":126,"chars":528},{"level":2,"title":"Undefined dates","slug":"undefined-dates","at":654,"chars":129},{"level":2,"title":"Normal dates and closing dates","slug":"normal-dates-and-closing-dates","at":783,"chars":219},{"level":2,"title":"Syntax","slug":"syntax","at":1002,"chars":333},{"level":2,"title":"Storing dates in the SQL server database","slug":"storing-dates-in-the-sql-server-database","at":1335,"chars":647},{"level":2,"title":"Example","slug":"example","at":1982,"chars":310},{"level":2,"title":"Related information","slug":"related-information","at":2292,"chars":175}],"text":"> Version: _Available or changed with runtime version 1.0._\nDenotes a date ranging from January 1, 1753 to December 31, 9999.\n## Instance methods\nThe following methods are available on instances of the Date data type.\nMethod name|Description\ndate-day-method|Gets the day of month.\ndate-dayofweek-method|Gets the day of the week.\ndate-month-method|Gets the month.\nToText([Boolean])<date-totext-method>|Converts the value to a text. Equivalent to calling Format(value, 0, 0).\ndate-weekno-method|Gets the week number.\ndate-year-method|Gets the year.\nThe displayed text format of the date is determined by your Region and Language Format setting in Windows.\n## Undefined dates\nAn undefined or blank date is specified by 0D. The undefined date is considered to be before all other dates.\n## Normal dates and closing dates\nAll 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.\n## Syntax\nThe syntax for defining DateTime format follows the ISO standard<https://en.wikipedia.org/wiki/ISO_8601>.\n The syntax for defining Date format is yyyymmddD, where D is a mandatory letter. For example, `20180325D`, read as the 25th of March, 2018.\nTo assign a normal date to a variable, use the following format: yyyymmddD.\n## Storing dates in the SQL server database\nSQL Server stores information about both date and time in columns of the DateTime types. For date fields, Dynamics 365 Business Central 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.\nThe Dynamics 365 Business Central 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.\nIf you store a date in the database that is outside the valid range for a SQL DateTime, a run-time error occurs.\n## Example\nThis 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).\n```al\nvar\n    Date1: Date;\nbegin\n    Date1 := 20180612D;\n    Message(Format(Date1));\nend;\n```\nThe message window displays the following:\n06/12/2018\n## Related information\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>\nAbout Dates in Business Central<../../devenv-about-dates>"}