F_GetWeekOfTheYear

F_GetWeekOfTheYear 1:

You can use this function to obtain the week of the year represented by a specified date and time value. The function uses the ISO 8601 standard definition of a week.

FUNCTION F_GetWeekOfTheYear : WORD

VAR_INPUT

VAR_INPUT
    in : DT;
END_VAR

in: Specified date and time value.

 

Example in structured text:

PROGRAM MAIN
VAR
    dtNow      : DT := DT#2008-03-17-12:00;
    weekOfYear : WORD;
END_VAR
weekOfYear := F_GetWeekOfTheYear(dtNow);

The result is: 12.

 

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v2.10.0 Build >= 1325

PC or CX (x86, ARM

TcUtilities.Lib