Date and time instructions
289
Part II IEC Instructions
DAY_OF_WEEK1
Return the day of the week
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
PLC types see page 1319
Data type I/O Function
DATE input date
ANY16 output 1 (Monday) – 7 (Sunday)
The value iDAY_OF_WEEK_value = 2 corresponds to Tuesday.
Description
DAY_OF_WEEK1 returns the day of the week for any date as an INT. The number 1 corresponds
to Monday; 7 corresponds to Sunday.
Data types
Example
In this example the function has been programmed in ladder diagram (LD) and structured text (ST).
POU header
All input and output variables used for programming this function have been declared in the POU
header.
LD
ST
When programming with structured text, enter the following:
iDAY_OF_WEEK_value := DAY_OF_WEEK1(DATE_value);