System.WorkDate Method

Version: Available or changed with runtime version 1.0.

Gets and sets the work date for the current session.


[WorkDate := ]  System.WorkDate([NewDate: Date])


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


[Optional] NewDate
 Type: Date
The new work date you want to set.

Return Value

[Optional] WorkDate
 Type: Date


To set the work date to follow the calendar day so that the work date is always the current date, set NewDate to Today or 0D. If you explicitly set NewDate to the current date, then the work date will also follow the calendar day.


This example shows how to use the WorkDate method.

    NewDate: Date;
    Text000: Label 'The new work date is: %1';
    NewDate := WorkDate(20180101D);  
    Message(Text000, NewDate);  

The code sets the work date to January 1, 2018, and returns the new date in a message. On a computer that has the regional format set to English (United States), the message window displays the following:

The work date is: 01/01/18

See Also

System Data Type
Getting Started with AL
Developing Extensions