Concatenate INT values to form date and time
CONCAT_DT_INT concatenates the INT values of year, month, day, hour, minute, second, and millisecond. The result is stored in the output variable of the data type DATE_AND_TIME. 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
4th input: hour
5th input: minute
6th input: second
7th input: millisecond
Output
Result
The Boolean output ERROR is set if the input values are invalid date or time values.
Inverse instruction:SPLIT_DT_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
DT_value: DATE_AND_TIME:=DT#2001-01-01-00:00:00;
YEAR_value: INT:=2011;
MONTH_value: INT:=12;
DAY_value: INT:=24;
HOUR_value: INT:=18;
MINUTE_value: INT:=29;
SECOND_value: INT:=59;
MILLISECOND_value: INT:=0;
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 := 9 ;
NETWORK_BODY
B(B_F,CONCAT_DT_INT!,Instance,17,0,26,9,,?DYEAR?DMONTH?DDAY?DHOUR?DMINUTE?DSECOND?DMILLISECOND?C?CERROR);
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_VARIN,,HOUR_value,15,4,17,6,);
B(B_VARIN,,MINUTE_value,15,5,17,7,);
B(B_VARIN,,SECOND_value,15,6,17,8,);
B(B_VARIN,,MILLISECOND_value,15,7,17,9,);
B(B_VAROUT,,DT_value,26,1,28,3,);
B(B_VAROUT,,ERROR,26,2,28,4,);
L(1,0,1,9);
END_NETWORK_BODY
END_NET_WORK
END_BODY
DT_value := CONCAT_DT_INT(YEAR := YEAR_value,
MONTH := MONTH_value,
DAY := DAY_value,
HOUR := HOUR_value,
MINUTE := MINUTE_value,
SECOND := SECOND_value,
MILLISECOND := MILLISECOND_value,
ERROR => ERROR);