F_GetDOYOfYearMonthDay

F_GetDOYOfYearMonthDay 1:

The function calculates the number of the day in the year.

FUNCTION F_GetDOYOfYearMonthDay: WORD

F_GetDOYOfYearMonthDay 2: Inputs

VAR_INPUT
    wYear  : WORD;
    wMonth : WORD;
    wDay   : WORD;
END_VAR

Name

Type

Description

wYear

WORD

Year (0 ~ 2999)

wMonth

WORD

Month (1 ~ 12)

wDay

WORD

Day (1 ~ 31)

Return parameter

Description

0

Error, wrong wYear, wMonth or wDay parameter value

> 0

No error. Number of the day in the year (1 ~ 366)

Example:

PROGRAM P_TEST_DOY
VAR
    wYear  : WORD;
    wDOY   : WORD;
    wMonth : WORD;
    wDay   : WORD;
END_VAR
wYear := 2009;
wMonth := 1;
wDay := 31;
wDOY := F_GetDOYOfYearMonthDay( wYear, wMonth, wDay );(* wDOY = 31 *)

wYear := 2009;
wMonth := 2;
wDay := 1;
wDOY := F_GetDOYOfYearMonthDay( wYear, wMonth, wDay );(* wDOY = 32 *)

wYear := 2009;
wMonth := 3;
wDay := 1;
wDOY := F_GetDOYOfYearMonthDay( wYear, wMonth, wDay );(* wDOY = 60 *)

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)