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

DMY2DATE Method (Date)

Gets a Date object based on a day, month, and year.


Date := DMY2DATE(Day [, Month] [, Year])  


Type: Integer

The number of the day in the month (1-31)

Type: Integer

The number of the month in the year (1-12). If you omit this optional parameter, the current month will be used as the default.

Type: Integer

The four-digit number of the year. If you omit this optional parameter, the current year is used as the default.

Property Value/Return Value

Type: Date

The resulting date.


This code example requires that you create the following global variables and text constants.

Variable name DataType
Day Integer
Month Integer
Year Integer
OutputDate Date
Text constant name ConstValue
Text000 Day number %1, month number %2, and year number %3 corresponds to the date %4.
Day := 17;  
Month := 2;  
Year := 2014;  
OutputDate := DMY2DATE(Day, Month, Year);  
MESSAGE(Text000, Day, Month, Year, OutputDate);  

On a computer that has the regional format set to English (United States), the message window displays the following:

Day number 17, month number 2, and year number 2014 corresponds to the date 02/17/14.

See Also

Date and Time Methods
Date Data Type