Convert

This function block is a converter for all the time based data types. It is possible to convert the data types OLEDATETIME, DT, DATE and TOD into each other and to their corresponding standard data types LONG and DOUBLE. Because the data type TIME represents a duration and not a point in time, it is only possible to convert it into and out of LONG.

This function block can be used to create a copy of time/date value by selecting the same time data type for input and output.

Parameters

The parameter dialog can be used to select the data type of the input and of the output.

Signals

Name I/O Type(s) Function
Inp I OLEDATETIME, DT, DATE, TOD, TIME, DOUBLE, LONG Input value
Out O OLEDATETIME, DT, DATE, TOD, TIME, DOUBLE, LONG Converted output value

Visualization

The data type for input and output will be depicted at the function block.

Comments

The data type can also be changed by connecting the input Inp. The connection of a supported data type will be denied, if the output is already connected and the input cannot be converted to that data type.

The OLEDATETIME data type covers a much wider range of dates than the LONG based data types. For a conversion of that data type to such a LONG based type it is possible to have a date, that cannot be handled by the result data type. In this case the minimum or maximum value of the result data type will be set.

The underlying data type for OLEDATETIME is DOUBLE, which has a broader data range than its defined period of time. The conversion from DOUBLE to OLEDATETIME may result in an outcome beyond/under the defined maximum/minimum. In this case the output will be set to these defined limits.