DT_TO_DATE block

Short summary

Name

DT_TO_DATE

→POU type

→function

Category

IEC-block, Convert, block with internal error diagnostic

Conform to →IEC-standard

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/check.svg no restrictions , but: images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg implementer-specific realization ; see "Functionality"

Graphical interface

images/download/thumbnails/414781023/DT_TO_DATE-version-1-modificationdate-1534929456717-api-v2.png

Available since

version 1.65.0 (for logi.CAD 3)

Functionality

The blocks serves for explicitly converting the date and time of day (DATE_AND_TIME) connected to input IN into a value of data type DATE.

The block discards the time and returns only the date.

Implementer-specific realization

The IEC-standard defines that it is an error when the connected value is not within the range of values overlapping for the data type of the input and for the result value as well as that the behavior in the case of such an error is implementer specific. In logi.CAD 3, an error is possible regarding the range of values overlapping for this block. The error occurs for the date 1.1.10000 and later dates. For these dates, the block returns the value DT#9999-12-31 (the block truncates the connected value) and the output ENO is set to value FALSE.

Inputs, return value


Identifier

→Data type

Description

Inputs:

IN

DATE_AND_TIME

date and time of day to be converted

Return value:

DATE


Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Internal error diagnostic for block

The block checks the value connected to the input. For the date 1.1.10000 and later dates, t he output ENO of the block is set to value FALSE (or an equivalent). (Moreover, the block returns the value DT#9999-12-31 .)

Example for usage within ST-editor

The calculated values are evaluated by using the Assert block .

FUNCTION_BLOCK ExampleDtToDate
VAR
result : DATE;
END_VAR
result := DT_TO_DATE(IN := DT#1970-01-01-00:00:12);
Assert(result = D#1970-01-01);
END_FUNCTION_BLOCK

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.