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

MAKE_DATE_AND_TIME_FROM_OPC

Function Name

MAKE_DATE_AND_TIME_FROM_OPC

Description

Provides a date and time output that is made up from the input string (which defines a time in the OPC time format). Typically, this input is provided by a value in the database, for example, the TrendOffset tag of a point.

Arguments

Input 1 {STRING - OPC Time Format}

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

Returns

Output {DATE_AND_TIME}

Example:

Function Block Diagram - MAKE_DATE_AND_TIME_FROM_OPC:

The MAKE_DATE_AND_TIME_FROM_OPC function provides a date and time value. The output is calculated by using the OPC time provided by the string input. In the example shown above, the V1 input is a tag (the tag represents the TrendOffset configuration property of a point. The TrendOffset is a time value defined in the OPC time format, in this case, M-10M). The MAKE_DATE_AND_TIME_FROM_OPC function uses the OPC time defined in the input string and the current time (on the server) to calculate its output.

So, at 09:11:00.000 on April 3rd 2006, the MAKE_DATE_AND_TIME_FROM_OPC function outputs 2006-04-03-09:01:00.000 (the current time - ten minutes from the start of the current minute as defined by the V1 input). Not that the date format used here is YYYY, MM, DD.

ST Program - MAKE_DATE_AND_TIME_FROM_OPC:

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

  • Output := MAKE_DATE_AND_TIME_FROM_OPC (Input 1);

Where Output and Input 1 are defined as variables earlier in the ST program. The Input 1 variable represents a String that contains a time value in the OPC time format.

Further Information

OPC Time Format: see Using OPC Time Formats in the ClearSCADA Guide to Core Configuration.


ClearSCADA 2015 R2