The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.

DATE2DMY Method (Date)

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


Number := DATE2DMY(Date, What)  


Type: Date

The input date.

Type: Integer

Specifies what the method 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.

Property Value/Return Value

Type: Integer

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


This example shows how to use the DATE2DMY method. This code example requires that you create the following global variables and text constants.

Name DataType
InputDate Date
Day Integer
Month Integer
Year Integer
Name ConstValue
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);  

The message window displays the following:

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

See Also

Date and Time Methods