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

SUB_DATE_DATE

Function Name

SUB_DATE_DATE

Description

Subtracts an date input from another date input to provide a time output.

Arguments

Input 1 {DATE}

Input 2 {DATE}

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_DATE_DATE:

A SUB_DATE_DATE function has 2 inputs (in this case, 2 constants):

  • Input 1 is set to D#2006-03-30
  • Input 2 is set to D#2005-03-21.

The SUB_DATE_DATE function returns a time value of 374d as 2006-03-30 minus 2005-03-21 = 374 days.

ST Program - SUB_DATE_DATE:

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

  • Output := SUB_DATE_DATE (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