Operator ‘TIME_TO/TIME_OF_DAY_TO’¶
This IEC operator is used for converting the TIME and TIME_OF_DAY data types into another data type.
<TIME data type>_TO_<data type>
Internally, CODESYS saves the time (in milliseconds) to a DWORD (for TIME_OF_DAY since 00:00). CODESYS converts this value.
For the STRING data type, the result is the time constant.
Attention
Information can be lost when converting from larger data types to smaller data types.
Examples
| ST Code | Result |
|---|---|
str := TIME_TO_STRING(T#12ms); |
T#12ms |
dw := TIME_TO_DWORD(T#5m); |
300000 |
si := TOD_TO_SINT(TOD#00:00:00.012); |
12 |
| FBD Code | Result |
|---|---|
T#12ms |
|
30000 |
|
12 |