Set date
This function block sets the components of a date for a data type connected to the input IO. The values of the subcomponents can be set via the input DD, MM, and YY.
For any component input containing a 0 or a negative value (or is not connected at all), this subcomponent will be taken directly out of the data type connected to the IO.
The new date will always be a valid date, even if the values of the subcomponents are out of proper range. In this case a correct date will be calculated by adjusting the other components:
Day | Month | Year | Date |
31 | 4 | 2009 | 01.05.2009 |
38 | 12 | 2009 | 07.01.2010 |
1 | 14 | 2009 | 01.02.2010 |
If the values of the component inputs cannot directly be combined into a valid date, the output Err will be set to HIGH.
Parameters
The parameter dialog can be used to select a data type.
Signals
Name | I/O | Type(s) | Function |
---|---|---|---|
IO | I/O | DATE, DT, OLEDATETIME | Date value |
DD | I | WORD | Day |
MM | I | WORD | Month |
YY | I | WORD | Year |
Err | O | BIT | Error indication |
Visualization
The current data type will be depicted on the function block.
Comments
The data type can also be changed by connecting the input IO.
For the LONG based data types 1970 is the smallest accepted and 2105 is the highest accepted value for the year. For the DOUBLE based data type 100 is the smallest possible and 9999 is the highest possible value for the year. A date beyond/under the defined maximum/minimum will be set to that limit.