F_GetDayOfWeek

F_GetDayOfWeek 1:

The function returns the number of the weekday according to DIN 1355 / ISO 8601. According to this standard the weekdays are numbered as follows: Monday = 1, Tuesday = 2, ... Sunday = 7.

FUNCTION F_GetDayOfWeek: WORD

VAR_INPUT

VAR_INPUT
    in : DT;
END_VAR

in: The date whose weekday number is to be determined.

Example:

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 platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_Utilities (System)