24 lines
546 B
Markdown
24 lines
546 B
Markdown
|
|
# FC_GetWeekNumber
|
||
|
|
|
||
|
|
## Description
|
||
|
|
Calculates the **ISO 8601 week number** (week 1 = week containing first Thursday)
|
||
|
|
Input: DT (DATE_AND_TIME)
|
||
|
|
Output: UINT (1..53)
|
||
|
|
|
||
|
|
## Features
|
||
|
|
- Follows ISO 8601 rules (Monday week start)
|
||
|
|
- Uses built-in Siemens functions (WEEKDAY, DAY_OF_YEAR)
|
||
|
|
|
||
|
|
## Input / Output
|
||
|
|
**Input**
|
||
|
|
- `stDateTime` : DT Date/time value
|
||
|
|
|
||
|
|
**Return**
|
||
|
|
- UINT Week number 1..53
|
||
|
|
|
||
|
|
## Usage example
|
||
|
|
```iecst
|
||
|
|
wCurrentWeek := "FC_GetWeekNumber"(stDateTime := #Now);
|
||
|
|
IF wCurrentWeek = 1 THEN
|
||
|
|
// New year logic...
|
||
|
|
END_IF;
|