System.WorkDate Method

Version: Available or changed with runtime version 1.0.

Gets and sets the work date for the current session.

Syntax

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

Note

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

Parameters

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

Return Value

[Optional] WorkDate
 Type: Date

Remarks

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.

Example

This example shows how to use the WorkDate method.

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

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