System.Date2DMY(Date, Integer) Method

Version: Available or changed with runtime version 1.0.

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

Syntax

Number :=   System.Date2DMY(Date: Date, Value: Integer)

Note

This method can be invoked without specifying the data type name.

Parameters

Date
 Type: Date
The input date.

Value
 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.

Return Value

Number
 Type: Integer

Example

This example shows how to use the Date2DMY method.

var
    InputDate: Date;
    Day: Integer;
    Month: Integer;
    Year: Integer;
    Text000: Label 'Today is day %1 of month %2 of the year %3.';
begin
    InputDate := Today;  
    Day := Date2DMY(InputDate,1);  
    Month := Date2DMY(InputDate,2);  
    Year := Date2DMY(InputDate,3);  
    Message(Text000,Day,Month,Year); 
end; 

The message window displays the following:

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

See Also

System Data Type
Get Started with AL
Developing Extensions