Data types are split into basic data types and complex data types. Data formats for time and date have both basic and complex data types.
1. Time of Day and wherein DATE belongs to the basic data types
1.1 DATE is a 16-bit data type in IEC format with a resolution of 1 day;
The format is D#1990-01-01~D#2168-12-31 or DATE#1990-1-1~DATE#2168-12-31;
It can be translated into and from INT type data. D#1990-1-1 corresponds to 1, and for every 1 increase in INT data, the DATE data value is increased by 1 day.
1.2 Time of Day is a 32-bit 24-hour time format with a resolution of 1ms
The format is TOD#00:00:00.000~TOD#23:59:59.999;
It can be translated into and from DINT type data. TOD#00:00:00.000 corresponds to 1, and Dever increases by 1 and the Time of Day time value increases by 1ms.
2. DATE_AND_TIME is a data type match
DATE_AND_TIME includes 8 bytes, the description of each byte is shown in the figure below;
The format is DT#1990-1-1-0:0:0.0 to DT#2089-12-31-23:59:59.999;