DATE_AND_TIME to date and time data in binary format
DT_TO_DTBIN converts a value of the data typeDATE_AND_TIME to a value of the data typeDTBIN.
Input
date and time
Output
date and time
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
bStart: BOOL:=FALSE;
DT_value: DATE_AND_TIME:=DT#2013-10-10-012:00:00;
DTBIN_value: DTBIN;
END_VAR
When the variable bStart is set to TRUE, the function is carried out.
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,,DT_value,7,2,9,4,);
B(B_VAROUT,,DTBIN_value,17,2,19,4,);
B(B_F,E_DT_TO_DTBIN!,,9,0,17,4,,?DEN?D?AENO?C);
B(B_CONTACT,,bStart,3,1,5,3,);
L(1,2,3,2);
L(5,2,9,2);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF bStart then
DTBIN_value := DT_TO_DTBIN(DT_value);
END_IF;