CLOSINGDATE Function (Date)

Returns the closing date for a Date Data Type.


ClosingDate := CLOSINGDATE(Date)

Parameters

Date

Type: Date

The input date.

Type: Date

The corresponding closing date for the input date.

All dates have a corresponding closing date. A closing date is a period in time following the given date but before the next normal date. Closing dates are sorted immediately after the corresponding normal date but before the next normal date.

xxxxxxD: Normal date

xxxxxxC: Closing date

The compiler cannot convert the expression xxxxxxC to a Date data type. Therefore, you must use the CLOSINGDATE function to create a closing date.

The first example shows how to use the CLOSINGDATE function. A normal date is given as input. This code example requires that you create the following variables and text constants in the C/AL Globals window.

Name DataType

Date1

Date

CloDate

Date

Text Constant ENU Value

Text000

The closing date for %1 is %2.

Date1 := 040409D;
CloDate := CLOSINGDATE(Date1);
MESSAGE(Text000, Date1, CloDate);

The following message is displayed:

The closing date for 04/04/09 is C04/04/09.

The second example shows some statements that do not work and explains why they do not work. This example requires that you create the following variables and text constants in the C/AL Globals window.

Name DataType

Date1

Date

CloDate1

Date

CloDate2

Date

Text Constant ENU Value

Text001

The closing date for %1 is %2.

// Date1 := 040409C;
// The previous statement does not compile because the compiler 
// cannot convert '040409C' to a Date data type.
Date1 := 040409D;
// The previous statement compiles. 
// The compiler converts '040409D' to a Date data type.
// CloDate1 := CLOSINGDATE(050509C);
// The previous statement does not compile because the compiler 
// cannot convert '050509C' to a Date data type and the CLOSINGDATE 
// function requires a Date data type for its parameter.
CloDate1 := CLOSINGDATE(Date1);
// The previous statement compiles.
// Date1 is a Date data type. 
CloDate2 := CLOSINGDATE(CloDate1);
// The previous statement compiles.
// CloDate1 is a Date data type.
MESSAGE(Text001, CloDate1, CloDate2);

The following message is displayed:

The closing date for C04/04/09 is C04/04/09.

Community Additions

ADD
Show: