ANY_TO_DATE

The ANY_TO_DATE instruction converts a String, Integer, Real, or Time data type to a Date data type.
Boolean, Byte, and Word date types are supported but are not recommended.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
ANY_TO_DATE
ANY_TO_DATE
ANY_TO_DATE parameters
Parameter
Parameter Type
Data Type
Description
EN
Input
BOOL
When set to true, the instruction is enabled.
  • TRUE: Execute the current computation.
  • FALSE: There is no computation.
Applies to ladder diagram programs.
i1
Input
BOOL
SINT
USINT
BYTE
INT
UINT
WORD
DINT
UDINT
DWORD
LINT
ULINT
LWORD
REAL
LREAL
TIME
STRING
  • Strings are directly converted to DATE data type and must be in the format of YYYY-MM-DD, DATE#YYYY-MM-DD, or D#YYYY-MM-DD.
  • Integers and Real, which must be positive, are in units of seconds and added to the date 1970-01-01.
  • Time is added to the date 1970-01-01.
o1
Output
DATE
Converted date value. Errors during conversion (such as a negative date) result in an INVALID result.
ENO
Output
BOOL
Enables output. Applies to ladder diagram programs.

ANY_TO_DATE examples

ANY_TO_DATE function block diagram example
ANY_TO_DATE function block diagram example
ANY_TO_DATE ladder diagram example
ANY_TO_DATE ladder diagram example
ANY_TO_DATE structured text example
ANY_TO_DATE structured text example
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal