IEC operator for conversions from the variable type DATE or DATE_AND_TIME to a different type.
DATE_TO_<data type>
DT_TO_<data type>
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 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 with conversion results:
Example |
Result |
---|---|
LD D#1970-01-01 |
FALSE |
LD D#1970-01-01 |
29952 |
LD D#1970-01-15-05:05: |
129 |
LD D#1998-02-13-14:20 |
'DT#1998-02-13-14:20' |