Get
This function block reads a subcomponent out of the time/date based data type connected to the input Inp and provides this component at the output Out.
Depending on the actual data type the following components can be selected: year, month, day, day of week, day of year, hour, minute, second, and millisecond.
The day of week is represented by a number between 1 (Sunday) and 7 (Saturday).
The data type TIME represents a duration, but will be interpreted as a structured time data type and its components can be read.
Parameters
The parameter dialog can be used to select a data type and the component to get from it.
Signals
Name | I/O | Type(s) | Function |
---|---|---|---|
Inp | I | TIME, DATE, TOD, DT, OLEDATETIME | Time/date value |
Out | I | WORD | Subcomponent |
Visualization
The current data type and the component to get will be depicted at the function block.
Comments
The data type can also be set by connecting the input Inp. If the currently selected subcomponent is not supported by the new data type, the subcomponent will be changed, too.
The underlying data type for OLEDATETIME is DOUBLE, which has a broader data range than its defined period of time. So it is possible to have an invalid date (beyond the maximum or under the minimum) for that data type. In this case the output will be set to -1, regardless of the component to get.