EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers.

DATE_TO/DT_TO Conversions

Definition

IEC operator for conversions from the variable type DATE or DATE_AND_TIME to a different type.

Syntax

DATE_TO_<data type>

DT_TO_<data type>

Conversion Results

The date will be stored internally in a DWORD in seconds since Jan. 1, 1970. This value will then be converted.

For STRING type variables, the result is the date constant.

Examples in ST

Examples in ST with conversion results:

Example

Result

b := DATE_TO_BOOL(D#1970-01-01);

FALSE

i := DATE_TO_INT(D#1970-01-15);

29952

byt := DT_TO_BYTE(DT#1970-01-15-05:05:05);

129

str := DT_TO_STRING(DT#1998-02-13-14:20);

'DT#1998-02-13-14:20'

Examples in IL

Examples in IL with conversion results:

Example

Result

LD            D#1970-01-01
DATE_TO_BOOL
ST            b

FALSE

LD            D#1970-01-01
DATE_TO_INT
ST            i

29952

LD            D#1970-01-15-05:05:
DATE_TO_BYTE
ST            byt

129

LD            D#1998-02-13-14:20
DATE_TO_STRI...
ST            str

'DT#1998-02-13-14:20'

Examples in FBD

G-SE-0024449.1.gif-high.gif

 

 

G-SE-0024450.1.gif-high.gif

 

 

G-SE-0024451.1.gif-high.gif

 

 

G-SE-0024448.1.gif-high.gif