SUB_LDATE_LDATE

Returns the difference between two long dates as a duration.

Note

This feature requires IEC 61131-3 Edition 3. Use --dialect iec61131-3-ed3 to enable it. See Enabling Dialects and Features for details.

Signature

     ┌─────────────────┐
IN1 ─┤                 │
     │ SUB_LDATE_LDATE ├─ OUT
IN2 ─┤                 │
     └─────────────────┘
FUNCTION SUB_LDATE_LDATE : LTIME
  VAR_INPUT
    IN1 : LDATE;
    IN2 : LDATE;
  END_VAR
END_FUNCTION

The return type is LTIME.

Inputs

Name

Type

Description

IN1

LDATE

The minuend date.

IN2

LDATE

The subtrahend date.

Outputs

Name

Type

Description

Return value

LTIME

IN1 minus IN2 as a duration.

Description

Returns the difference IN1 minus IN2 as an LTIME duration in milliseconds. The internal subtraction is in seconds, then converted to milliseconds.

The short form is SUB_DATE_DATE. An operand of the short type (DATE where LDATE is expected) is accepted and widened to 64 bits.

Example

result := SUB_LDATE_LDATE(LDATE#2000-01-02, LDATE#2000-01-01);
(* result = LTIME#24h *)

See Also

References

  • IEC 61131-3 Edition 3, Table 30