SUB_DATE_DATE

Subtract DATE from DATE

SUB_DATE_DATE subtracts a value of the data type DATE from another DATE value. The result is stored in the output variable of the data type TIME.

Parameters

Input

Unnamed input (DATE)

1st input: minuend

Unnamed input (DATE)

2nd input: subtrahend

Output

Unnamed output (TIME)

Result

Remarks

The TIME result is only valid if the difference between the minuend and subtrahend is smaller than or equal to the maximum TIME duration allowed. Otherwise an overflow of the TIME result variable occurs and the CARRY flag is set.

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
		DATE_value1: DATE:=D#2010-06-30;
		DATE_value2: DATE:=D#2010-01-01;
		TIME_result: TIME:=T#0s;
	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_F,SUB_DATE_DATE!,Instance,17,1,26,4,,?D?D?C);
B(B_VARIN,,DATE_value1,15,1,17,3,);
B(B_VARIN,,DATE_value2,15,2,17,4,);
B(B_VAROUT,,TIME_result,26,1,28,3,);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

TIME_result := SUB_DATE_DATE(DATE_value1, DATE_value2);

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