{"title":"System.ClosingDate(Date) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/system/system-closingdate-method/","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/system/system-closingdate-method, 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/system/system-closingdate-method","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":"Gets the closing date for a Date Data Type.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"System.ClosingDate(Date) Method","slug":"systemclosingdatedate-method","at":0,"chars":2490},{"level":2,"title":"Syntax","slug":"syntax","at":138,"chars":143},{"level":2,"title":"Parameters","slug":"parameters","at":281,"chars":64},{"level":2,"title":"Return Value","slug":"return-value","at":345,"chars":57},{"level":2,"title":"Remarks","slug":"remarks","at":402,"chars":447},{"level":2,"title":"Example 1","slug":"example-1","at":849,"chars":397},{"level":2,"title":"Example 2","slug":"example-2","at":1246,"chars":1110},{"level":2,"title":"Related information","slug":"related-information","at":2356,"chars":134}],"text":"# System.ClosingDate(Date) Method\n> Version: _Available or changed with runtime version 1.0._\nGets the closing date for a Date Data Type.\n## Syntax\n```al\nClosingDate :=   System.ClosingDate(Date: Date)\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\nDate\nType: ../date/date-data-type\nThe input date.\n## Return Value\nClosingDate\nType: ../date/date-data-type\n## Remarks\nAll dates have a corresponding closing date. A closing date is a period in time following the given date but before the next regular date. Closing dates are sorted immediately after the corresponding regular date but before the next regular date.\nxxxxxxD: Regular date\nxxxxxxC: Closing date\nThe compiler cannot convert the expression xxxxxxC to a Date data type. Therefore, you must use the ClosingDate method to create a closing date.\n## Example 1\nThe first example shows how to use the ClosingDate method. A regular date is given as input.\n```al\nvar\n    Date1: Date;\n    CloDate: Date;\n    Text000: Label 'The closing date for %1 is %2.';\nbegin\n    Date1 := 20140404D;\n    CloDate := ClosingDate(Date1);\n    Message(Text000, Date1, CloDate);\nend;\n```\nThe following message is displayed:\nThe closing date for 04/04/14 is C04/04/14.\n## Example 2\nThe second example shows some statements that do not work and explains why they do not work.\n```al\nvar\n    Date1: Date;\n    CloDate1: Date;\n    CloDate2: Date;\n    Text000: Label 'The closing date for %1 is %2.';\nbegin\n    // Date1 := 20140404C;\n    // The previous statement does not compile because the compiler\n    // cannot convert '20140404C' to a Date data type.\n    Date1 := 20140404D;\n    // The previous statement compiles.\n    // The compiler converts '20140404D' to a Date data type.\n    // CloDate1 := ClosingDate(20140505C);\n    // The previous statement does not compile because the compiler\n    // cannot convert '20140505C' to a Date data type and the ClosingDate\n    // method requires a Date data type for its parameter.\n    CloDate1 := ClosingDate(Date1);\n    // The previous statement compiles.\n    // Date1 is a Date data type.\n    CloDate2 := ClosingDate(CloDate1);\n    // The previous statement compiles.\n    // CloDate1 is a Date data type.\n    Message(Text001, CloDate1, CloDate2);\nend;\n```\nThe following message is displayed:\nThe closing date for C04/04/14 is C04/04/14.\n## Related information\nsystem-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}