Check whether DATE_AND_TIME is valid
IS_VALID_DT checks whether the combination of INT values for year, month, day, hour, minute, second, and millisecond is a valid date and time value. The Boolean output flag is set if the date and time value is valid.
Input
1st input: year
2nd input: month
3rd input: day
4th input: hour
5th input: minute
6th input: second
7th input: millisecond
Output
set to TRUE if the resulting date and time value is valid
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
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;
VALID: 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_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_F,IS_VALID_DT_INT!,Instance,17,0,26,9,);
B(B_VAROUT,,VALID,26,1,28,3,);
L(1,0,1,9);
END_NETWORK_BODY
END_NET_WORK
END_BODY
VALID := IS_VALID_DT_INT(YEAR := YEAR_value,
MONTH := MONTH_value,
DAY := DAY_value,
HOUR := HOUR_value,
MINUTE := MINUTE_value,
SECOND := SECOND_value,
MILLISECOND := MILLISECOND_value);