TIME_TO/TIME_OF_DAY Conversions
IEC operator for conversions from the variable type TIME or TIME_OF_DAY to a different type.
TIME_TO_<data type>
TOD_TO_<data type>
The time will be stored internally in a DWORD in milliseconds (beginning with 12:00 A.M. for the TIME_OF_DAY variable). This value will then be converted.
In case of type STRING the result is a time constant.
Examples in ST with conversion results:
Example |
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 |
Examples in IL with conversion results:
Example |
Result |
---|---|
LD T#12ms |
'T#12ms' |
LD T#300000ms |
300000 |
LD TOD#00:00:00.012 |
12 |