You are here: Core Reference > Coding > Logic > SUB_DT_DT

SUB_DT_DT

Function Name

SUB_DT_DT

Description

Subtracts a date time input from another date time input to provide a time output. (It outputs the time difference between the two input dates and times).

Arguments

Input 1 {DATE_AND_TIME}

Input 2 {DATE_AND_TIME}

For more information on the data types for the inputs and outputs, see Data Type Hierarchy.

Returns

Output {TIME}

The Output is the result of Input 1 - Input 2

Example:

Function Block Diagram - SUB_DT_DT:

A SUB_DT_DT function has 2 inputs (in this case, a NOW function and a constant):

  • Input 1 is connected to a NOW function
  • Input 2 is set to DT#2002-03-11-10:00:25.431.

The SUB_DATE_DATE function returns a time value that is the result of the current date and time - 2002-03-11-10:00:25.431.

ST Program - SUB_DT_DT:

The syntax for a SUB_DT_DT function in an ST Program is:

  • Output := SUB_DT_DT (Input 1, Input 2)

Where Output, Input 1 and Input 2 are defined as variables earlier in the ST program. Input 1 and Input 2 are date and time values and the Output is a time value.


ClearSCADA 2015 R2