TIME_TO/TIME_OF_DAY ConversionsΒΆ

Converting from the variable type TIME or TIME_OF_DAY to a different 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.

When you perform a type conversion from a larger to a smaller type, you risk losing some information.

For the STRING type variable, the result is a time constant.

Examples in IL:

(*Result is 'T#12ms' *)
LD T#12ms
TIME_TO_STRING
ST str

(*Result is 300000 *)
LD T#300000ms
TIME_TO_DWORD
ST dw

(*Result is 12 *)
LD TOD#00:00:00.012
TOD_TO_SINT
ST si

Examples in ST:

(* Result is T#12ms *)
#str :=TIME_TO_STRING(T#12ms);

(* Result is 300000 *)
dw:=TIME_TO_DWORD(T#5m);

(* Result is 12 *)
si:=TOD_TO_SINT(TOD#00:00:00.012);

Examples in FBD:

../_images/2dd9a78669fad1c20a317d31278124eb
../_images/124d384c69fab55d0a317d315721c461
../_images/ea0dcc2b69fa97430a317d313b1b3cc2