Concatenate INT values to form a date
CONCAT_DATE_INT concatenates the INT values of year, month, and day. The result is stored in the output variable of the data type DATE. The Boolean output ERROR is set if the input values are invalid date or time values.
Input
1st input: year
2nd input: month
3rd input: day
Output
Result
The Boolean output ERROR is set if the input values are invalid date or time values.
Inverse instruction:SPLIT_DATE_INT
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
DATE_value: DATE:=D#2001-01-01;
YEAR_value: INT:=2011;
MONTH_value: INT:=12;
DAY_value: INT:=24;
ERROR: BOOL:=FALSE;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_VARIN,,YEAR_value,15,1,17,3,);
B(B_VARIN,,MONTH_value,15,2,17,4,);
B(B_VARIN,,DAY_value,15,3,17,5,);
B(B_VAROUT,,DATE_value,27,1,29,3,);
B(B_VAROUT,,ERROR,27,2,29,4,);
B(B_F,CONCAT_DATE_INT!,Instance,17,0,27,5,,?DYEAR?DMONTH?DDAY?C?CERROR);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
DATE_value := CONCAT_DATE_INT(YEAR := YEAR_value,
MONTH := MONTH_value,
DAY := DAY_value,
ERROR => ERROR);