F_GetWeekOfTheYear

The function returns the calendar week number for a specified date according to the DIN 1355 / ISO 8601 standard.
- The first calendar week is defined as the first week that contains a minimum of four days of the new year (DIN 1355 / ISO 8601).
 - The calendar weeks start on a Monday. Each calendar week contains 7 days.
 - The returned value in the first calendar week has the number 1.
 - 29, 30 and 31 December may belong to the first calendar week of the following year.
 - 1, 2 and 3 January may belong to the last calendar week of the previous year.
 
FUNCTION F_GetWeekOfTheYear : WORD
 Inputs
VAR_INPUT
    in : DT;
END_VARName  | Type  | Description  | 
|---|---|---|
in  | DT  | The date whose calendar week is to be determined.  | 
Example:
PROGRAM MAIN
VAR
    dtNow      : DT := DT#2008-03-17-12:00;
    weekOfYear : WORD;
END_VARweekOfYear := F_GetWeekOfTheYear(dtNow);The result is 12.
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)  |