SUB_DT_DT - Subtracts one date and time value from another

Help Contents


Returns the difference between two date and time values as an interval.

Informal Syntax:

SUB_DT_DT( In1, In2 )

Formal Syntax:

SUB_DT_DT( In1:=expression, In2:=expression )


In1DATE_AND_TIMEThe first date and time value.
In2DATE_AND_TIMEThe second date and time value to subtract from the first.

Return Value

The function SUB_DT_DT returns an interval, the result of In1 - In2.

If In2 is greater than In1, the returned interval will be negative.


ExampleReturn Value
SUB_DT_DT( DT#2013-01-07-12:00:00, DT#2013-01-01-00:00:00 )T#6d12h
SUB_DT_DT( DT#2013-01-07-12:00:00, DT#2013-01-08-00:00:00 )T#-12h
SUB_DT_DT( DT#2013-01-07-12:00:00, DT#2013-01-07-12:00:00 )T#0

Standards Compliance

Table 30.9b - IEC 61131-3 Second Edition.

Table 35.9b - IEC 61131-3 Third Edition.

Further Information

Date and Time Functions

For other date and time functions.


For the meaning of terms used in Fernhill SCADA.