TIME_TO/TIME_OF_DAY Conversions

Definition

IEC operator for conversions from the variable type TIME or TIME_OF_DAY to a different type.

Syntax

TIME_TO_<data type>

TOD_TO_<data type>

Conversion Results

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

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

Examples in IL with conversion results:

Example

Result

LD               T#12ms
TIME_TO_STRI...
ST               str

'T#12ms'

LD               T#300000ms
TIME_TO_DWORD
ST               dw

300000

LD               TOD#00:00:00.012
TIME_TO_SINT
ST               si

12  

Examples in FBD

G-SE-0024446.1.gif-high.gif

 

 

G-SE-0024447.1.gif-high.gif

 

 

G-SE-0024445.1.gif-high.gif