F_GetDayOfWeek

F_GetDayOfWeek 1:

You can use this function to obtain the day of week represented by a specified date and time value. The function uses the ISO 8601 standard definition of a week. A week is considered to start a Monday = 1and end on Sunday = 7.

FUNCTION F_GetDayOfWeek : WORD

VAR_INPUT

VAR_INPUT
    in : DT;
END_VAR

in: Specified date and time value.

 

Example in structured text:

PROGRAM MAIN
VAR
    dtFirst : DT := DT#2008-01-01-00:00;
    dayOfWeek : WORD;
END_VAR
dayOfWeek := F_GetDayOfWeek(dtFirst);

The result is: 2 (Tuesday)

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v2.10.0 Build >= 1325

PC or CX (x86, ARM)

TcUtilities.Lib