SPLIT_DT_INT

Split DATE_AND_TIME into INT values

SPLIT_DT_INT splits a value of the data type DATE_AND_TIME into INT values for year, month, day, hour, minute, second, and millisecond.

Parameters

Input

IN (DATE_AND_TIME)

date and time

Output

YEAR (INT)

year

MONTH (INT)

month

DAY (INT)

day

HOUR (INT)

hour

MINUTE (INT)

minute

SECOND (INT)

second

MILLISECOND (INT)

millisecond

Example

POU header

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#2011-12-24-18:29:59;
		YEAR_value: INT:=0;
		MONTH_value: INT:=0;
		DAY_value: INT:=0;
		HOUR_value: INT:=0;
		MINUTE_value: INT:=0;
		SECOND_value: INT:=0;
		MILLISECOND_value: INT:=0;
	END_VAR

LD body

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,SPLIT_DT_INT!,Instance,15,0,24,9,,?DIN?CYEAR?CMONTH?CDAY?CHOUR?CMINUTE?CSECOND?CMILLISECOND);
B(B_VARIN,,DT_value,13,1,15,3,);
B(B_VAROUT,,YEAR_value,24,1,26,3,);
B(B_VAROUT,,MONTH_value,24,2,26,4,);
B(B_VAROUT,,DAY_value,24,3,26,5,);
B(B_VAROUT,,HOUR_value,24,4,26,6,);
B(B_VAROUT,,MINUTE_value,24,5,26,7,);
B(B_VAROUT,,SECOND_value,24,6,26,8,);
B(B_VAROUT,,MILLISECOND_value,24,7,26,9,);
L(1,0,1,9);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

SPLIT_DT_INT(IN := DT_value, 
         YEAR => YEAR_value, 
         MONTH => MONTH_value, 
         DAY => DAY_value, 
         HOUR => HOUR_value, 
         MINUTE => MINUTE_value, 
         SECOND => SECOND_value, 
         MILLISECOND => MILLISECOND_value);

Modified on: 2019-01-25Feedback on this pagePanasonic hotline