DATE2DMY Function (Date)

Returns the day, month, or year of a Date Data Type.


Number := DATE2DMY(Date, What)

Parameters

Date

Type: Date

The input date.

What

Type: Integer

Specifies what the function should return. The valid options are 1, 2, and 3.

The value 1 corresponds to Day (1-31).

The value 2 corresponds to Month (1-12).

The value 3 corresponds to Year.

Type: Integer

The day, month, or year of the Date parameter.

This example shows how to use the DATE2DMY function. This code example requires you to create the following variables and text constants in the C/AL Globals window.

Variable name DataType

InputDate

Date

Day

Integer

Month

Integer

Year

Integer

Text constant name Constant Value

Text000

Today is day %1 of month %2 of the year %3.

InputDate := TODAY;
Day := DATE2DMY(InputDate,1);
Month := DATE2DMY(InputDate,2);
Year := DATE2DMY(InputDate,3);
MESSAGE(Text000,Day,Month,Year);

The message window displays the following:

Today is day 16 of month 2 of the year 2008.

Community Additions

ADD
Show: