SUB_DT_TIME

Subtract TIME from DATE_AND_TIME

SUB_DT_TIME subtracts a value of the data type TIME from a value of the data type DATE_AND_TIME. The result is stored in the output variable of the data type DATE_AND_TIME.

Parameters

Input

Unnamed input (DATE_AND_TIME)

1st input: minuend

Unnamed input (TIME)

2nd input: subtrahend

Output

Unnamed output (DATE_AND_TIME)

Result

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;
		TIME_value: TIME:=T#2h35m38s560ms;
		DT_result: DATE_AND_TIME:=DT#2001-01-01-00:00:00;
	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 := 5 ;
        NETWORK_BODY
B(B_VARIN,,DT_value,16,1,18,3,);
B(B_VARIN,,TIME_value,16,2,18,4,);
B(B_VAROUT,,DT_result,27,1,29,3,);
B(B_F,SUB_DT_TIME!,Instance,18,1,26,4,,?D?D?C);
L(26,2,27,2);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

DT_result := SUB_DT_TIME(DT_value, TIME_value);

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